1use crate::raft_engine::protos::logstore::EntryImpl;
16
17mod backend;
18pub mod log_store;
19
20pub use backend::RaftEngineBackend;
21pub use raft_engine::Config;
22use store_api::logstore::entry::{Entry, NaiveEntry};
23use store_api::logstore::provider::Provider;
24use store_api::storage::RegionId;
25
26#[allow(renamed_and_removed_lints)]
27pub mod protos {
28 include!(concat!(env!("OUT_DIR"), concat!("/", "protos/", "mod.rs")));
29}
30
31impl EntryImpl {
32 pub fn create(id: u64, ns: u64, data: Vec<u8>) -> Self {
33 Self {
34 id,
35 namespace_id: ns,
36 data,
37 ..Default::default()
38 }
39 }
40}
41
42impl From<EntryImpl> for Entry {
43 fn from(
44 EntryImpl {
45 id,
46 namespace_id,
47 data,
48 ..
49 }: EntryImpl,
50 ) -> Self {
51 Entry::Naive(NaiveEntry {
52 provider: Provider::raft_engine_provider(namespace_id),
53 region_id: RegionId::from_u64(namespace_id),
54 entry_id: id,
55 data,
56 })
57 }
58}