Trait tikv::storage::Engine[][src]

pub trait Engine: 'static + Send + Clone {
    type Snap: Snapshot;
    type Local: KvEngine;
    pub fn kv_engine(&self) -> Self::Local;
pub fn snapshot_on_kv_engine(
        &self,
        start_key: &[u8],
        end_key: &[u8]
    ) -> Result<Self::Snap, Error>;
pub fn modify_on_kv_engine(
        &self,
        modifies: Vec<Modify, Global>
    ) -> Result<(), Error>;
pub fn async_snapshot(
        &self,
        ctx: SnapContext<'_>,
        cb: Box<dyn FnOnce((CbContext, Result<Self::Snap, Error>)) + 'static + Send, Global>
    ) -> Result<(), Error>;
pub fn async_write(
        &self,
        ctx: &Context,
        batch: WriteData,
        write_cb: Box<dyn FnOnce((CbContext, Result<(), Error>)) + 'static + Send, Global>
    ) -> Result<(), Error>; pub fn async_write_ext(
        &self,
        ctx: &Context,
        batch: WriteData,
        write_cb: Box<dyn FnOnce((CbContext, Result<(), Error>)) + 'static + Send, Global>,
        _proposed_cb: Option<Box<dyn FnOnce() + 'static + Send, Global>>,
        _committed_cb: Option<Box<dyn FnOnce() + 'static + Send, Global>>
    ) -> Result<(), Error> { ... }
pub fn write(&self, ctx: &Context, batch: WriteData) -> Result<(), Error> { ... }
pub fn release_snapshot(&self) { ... }
pub fn snapshot(&self, ctx: SnapContext<'_>) -> Result<Self::Snap, Error> { ... }
pub fn put(
        &self,
        ctx: &Context,
        key: Key,
        value: Vec<u8, Global>
    ) -> Result<(), Error> { ... }
pub fn put_cf(
        &self,
        ctx: &Context,
        cf: &'static str,
        key: Key,
        value: Vec<u8, Global>
    ) -> Result<(), Error> { ... }
pub fn delete(&self, ctx: &Context, key: Key) -> Result<(), Error> { ... }
pub fn delete_cf(
        &self,
        ctx: &Context,
        cf: &'static str,
        key: Key
    ) -> Result<(), Error> { ... }
pub fn get_mvcc_properties_cf(
        &self,
        &'static str,
        _safe_point: TimeStamp,
        _start: &[u8],
        _end: &[u8]
    ) -> Option<MvccProperties> { ... } }

Engine defines the common behaviour for a storage engine type.

Associated Types

type Snap: Snapshot[src]

type Local: KvEngine[src]

Loading content...

Required methods

pub fn kv_engine(&self) -> Self::Local[src]

Local storage engine.

pub fn snapshot_on_kv_engine(
    &self,
    start_key: &[u8],
    end_key: &[u8]
) -> Result<Self::Snap, Error>
[src]

pub fn modify_on_kv_engine(
    &self,
    modifies: Vec<Modify, Global>
) -> Result<(), Error>
[src]

Write modifications into internal local engine directly.

pub fn async_snapshot(
    &self,
    ctx: SnapContext<'_>,
    cb: Box<dyn FnOnce((CbContext, Result<Self::Snap, Error>)) + 'static + Send, Global>
) -> Result<(), Error>
[src]

pub fn async_write(
    &self,
    ctx: &Context,
    batch: WriteData,
    write_cb: Box<dyn FnOnce((CbContext, Result<(), Error>)) + 'static + Send, Global>
) -> Result<(), Error>
[src]

Loading content...

Provided methods

pub fn async_write_ext(
    &self,
    ctx: &Context,
    batch: WriteData,
    write_cb: Box<dyn FnOnce((CbContext, Result<(), Error>)) + 'static + Send, Global>,
    _proposed_cb: Option<Box<dyn FnOnce() + 'static + Send, Global>>,
    _committed_cb: Option<Box<dyn FnOnce() + 'static + Send, Global>>
) -> Result<(), Error>
[src]

Writes data to the engine asynchronously with some extensions.

When the write request is proposed successfully, the proposed_cb is invoked. When the write request is finished, the write_cb is invoked.

pub fn write(&self, ctx: &Context, batch: WriteData) -> Result<(), Error>[src]

pub fn release_snapshot(&self)[src]

pub fn snapshot(&self, ctx: SnapContext<'_>) -> Result<Self::Snap, Error>[src]

pub fn put(
    &self,
    ctx: &Context,
    key: Key,
    value: Vec<u8, Global>
) -> Result<(), Error>
[src]

pub fn put_cf(
    &self,
    ctx: &Context,
    cf: &'static str,
    key: Key,
    value: Vec<u8, Global>
) -> Result<(), Error>
[src]

pub fn delete(&self, ctx: &Context, key: Key) -> Result<(), Error>[src]

pub fn delete_cf(
    &self,
    ctx: &Context,
    cf: &'static str,
    key: Key
) -> Result<(), Error>
[src]

pub fn get_mvcc_properties_cf(
    &self,
    &'static str,
    _safe_point: TimeStamp,
    _start: &[u8],
    _end: &[u8]
) -> Option<MvccProperties>
[src]

Loading content...

Implementors

impl Engine for BTreeEngine[src]

type Snap = BTreeEngineSnapshot

type Local = PanicEngine

pub fn async_snapshot(
    &self,
    _ctx: SnapContext<'_>,
    cb: Box<dyn FnOnce((CbContext, Result<<BTreeEngine as Engine>::Snap, Error>)) + 'static + Send, Global>
) -> Result<(), Error>
[src]

warning: It returns a fake snapshot whose content will be affected by the later modifies!

impl Engine for RocksEngine[src]

type Snap = Arc<RocksSnapshot>

type Local = RocksEngine

impl<E, S> Engine for RaftKv<E, S> where
    E: KvEngine,
    S: RaftStoreRouter<E> + LocalReadRouter<E> + 'static, 
[src]

type Snap = RegionSnapshot<E::Snapshot>

type Local = E

Loading content...