Repository navigation
Closed
Description
kv::adapter still users Bytes in many places, we should migrate to Buffer instead.
- We should use Buffer as Reader
opendal/core/src/raw/adapters/kv/backend.rs
Lines 65 to 66 in 22b9c62
| type Reader = Bytes; | |
| type BlockingReader = Bytes; |
- We should use QueueBuf as Writer
opendal/core/src/raw/adapters/kv/backend.rs
Lines 235 to 240 in 22b9c62
| pub struct KvWriter<S> { | |
| kv: Arc<S>, | |
| path: String, | |
| buffer: FlexBuffer, | |
| } |
- We should return
Bufferingetandblocking_get
opendal/core/src/raw/adapters/kv/api.rs
Lines 35 to 49 in 22b9c62
| /// Get a key from service. | |
| /// | |
| /// - return `Ok(None)` if this key is not exist. | |
| async fn get(&self, path: &str) -> Result<Option<Vec<u8>>>; | |
| /// The blocking version of get. | |
| fn blocking_get(&self, path: &str) -> Result<Option<Vec<u8>>> { | |
| let _ = path; | |
| Err(Error::new( | |
| ErrorKind::Unsupported, | |
| "kv adapter doesn't support this operation", | |
| ) | |
| .with_operation("kv::Adapter::blocking_get")) | |
| } |
- We should accept
Bufferinsetandblocking_set
opendal/core/src/raw/adapters/kv/api.rs
Lines 52 to 64 in 22b9c62
| async fn set(&self, path: &str, value: &[u8]) -> Result<()>; | |
| /// The blocking version of set. | |
| fn blocking_set(&self, path: &str, value: &[u8]) -> Result<()> { | |
| let _ = (path, value); | |
| Err(Error::new( | |
| ErrorKind::Unsupported, | |
| "kv adapter doesn't support this operation", | |
| ) | |
| .with_operation("kv::Adapter::blocking_set")) | |
| } | |
This might affect many services, please feel free to link to this issue.
Metadata
Metadata
Assignees
Labels
No labels
Activity