Skip to content

Commit

Permalink
Disambiguate method name
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Jul 27, 2023
1 parent 97e6a85 commit a873fa4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ll/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ impl<M: StorageMedium> ObjectWriter<M> {
}
}

async fn write_bytes(&mut self, medium: &mut M, buffer: &[u8]) -> Result<(), StorageError> {
async fn write_payload(&mut self, medium: &mut M, buffer: &[u8]) -> Result<(), StorageError> {
medium
.write(self.object.location.block, self.data_write_offset(), buffer)
.await?;
Expand All @@ -579,7 +579,7 @@ impl<M: StorageMedium> ObjectWriter<M> {
// FIXME: This copy is a bit unfortunate, but it's only 4 bytes. We should still
// probably refactor this to avoid the copy.
let buffer = core::mem::take(&mut self.buffer);
self.write_bytes(medium, &buffer).await?;
self.write_payload(medium, &buffer).await?;
}

Ok(())
Expand Down Expand Up @@ -632,15 +632,15 @@ impl<M: StorageMedium> ObjectWriter<M> {
let aligned_count = len - len % M::WRITE_GRANULARITY.width();

let (aligned, remaining) = data.split_at(aligned_count);
self.write_bytes(medium, aligned).await?;
self.write_payload(medium, aligned).await?;

data = self.fill_buffer(remaining);
debug_assert!(data.is_empty());

Ok(())
}

async fn write_size(&mut self, medium: &mut M) -> Result<(), StorageError> {
async fn write_payload_size(&mut self, medium: &mut M) -> Result<(), StorageError> {
self.flush(medium).await?;
self.object.set_payload_size(medium, self.cursor).await
}
Expand Down Expand Up @@ -668,7 +668,7 @@ impl<M: StorageMedium> ObjectWriter<M> {
}

// must be two different writes for powerloss safety
self.write_size(medium).await?;
self.write_payload_size(medium).await?;
self.set_state(medium, ObjectState::Finalized).await?;

Ok(ObjectInfo::with_header(self.object))
Expand All @@ -681,7 +681,7 @@ impl<M: StorageMedium> ObjectWriter<M> {
}

if self.object.state() == ObjectState::Allocated {
self.write_size(medium).await?;
self.write_payload_size(medium).await?;
}

self.set_state(medium, ObjectState::Deleted).await
Expand Down

0 comments on commit a873fa4

Please sign in to comment.