Skip to content

Commit

Permalink
fix file open policy
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelvlach committed Mar 25, 2024
1 parent e2666b9 commit 19967be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion agdb/src/storage/file_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ impl StorageData for FileStorage {
fn new(name: &str) -> Result<Self, DbError> {
let mut file = OpenOptions::new()
.read(true)
.append(true)
.write(true)
.truncate(false)
.create(true)
.open(name)?;
let mut wal: WriteAheadLog = WriteAheadLog::new(name)?;
Expand Down
3 changes: 2 additions & 1 deletion agdb/src/storage/write_ahead_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ impl WriteAheadLog {
let mut wal = Self {
file: OpenOptions::new()
.read(true)
.append(true)
.write(true)
.truncate(false)
.create(true)
.open(WriteAheadLog::wal_filename(filename))?,
};
Expand Down

0 comments on commit 19967be

Please sign in to comment.