MCPcopy Create free account
hub / github.com/cosdata/cosdata / new

Method new

src/models/wal.rs:100–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99impl WALFile {
100 pub fn new() -> Result<Self, BufIoError> {
101 let bufman = FilelessBufferManager::new(8192)?;
102 let cursor = bufman.open_cursor()?;
103 bufman.update_u32_with_cursor(cursor, 0)?;
104 bufman.update_u32_with_cursor(cursor, 0)?;
105 bufman.update_u32_with_cursor(cursor, 0)?;
106
107 Ok(Self {
108 bufman,
109 cursor,
110 read_lock: Mutex::new(()),
111 records_upserted: AtomicU32::new(0),
112 records_deleted: AtomicU32::new(0),
113 total_operations: AtomicU32::new(0),
114 })
115 }
116
117 pub fn from_existing(root_path: &Path, version: VersionNumber) -> Result<Self, BufIoError> {
118 let file_path: Arc<Path> = root_path.join(format!("{}.wal", *version)).into();

Callers

nothing calls this directly

Calls 2

open_cursorMethod · 0.80

Tested by

no test coverage detected