-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch wal to sync implementation
Signed-off-by: bsbds <[email protected]>
- Loading branch information
Showing
7 changed files
with
157 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::io; | ||
|
||
/// Decoding of frames via buffers. | ||
pub(super) trait Decoder { | ||
/// The type of decoded frames. | ||
type Item; | ||
|
||
/// The type of unrecoverable frame decoding errors. | ||
type Error: From<io::Error>; | ||
|
||
/// Attempts to decode a frame from the provided buffer of bytes. | ||
fn decode(&mut self, src: &[u8]) -> Result<(Self::Item, usize), Self::Error>; | ||
} | ||
|
||
/// Trait of helper objects to write out messages as bytes | ||
pub(super) trait Encoder<Item> { | ||
/// The type of encoding errors. | ||
type Error: From<io::Error>; | ||
|
||
/// Encodes a frame | ||
fn encode(&mut self, item: Item) -> Result<Vec<u8>, Self::Error>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.