pub trait ZephyrDatabase {
// Required methods
fn read_raw(
&self,
user_id: i64,
read_point_hash: [u8; 16],
read_data: &[i64],
condition: Option<&[WhereCond]>,
condition_args: Option<Vec<Vec<u8>>>,
) -> Result<Vec<u8>, DatabaseError>;
fn write_raw(
&self,
user_id: i64,
written_point_hash: [u8; 16],
write_data: &[i64],
written: Vec<Vec<u8>>,
) -> Result<(), DatabaseError>;
fn update_raw(
&self,
user_id: i64,
written_point_hash: [u8; 16],
write_data: &[i64],
written: Vec<Vec<u8>>,
condition: &[WhereCond],
condition_args: Vec<Vec<u8>>,
) -> Result<(), DatabaseError>;
}
Expand description
Zephyr-compatible database trait. Implementations of Zephyr that allow from a database from within a Zephyr execution must implement this trait.
Required Methods§
sourcefn read_raw(
&self,
user_id: i64,
read_point_hash: [u8; 16],
read_data: &[i64],
condition: Option<&[WhereCond]>,
condition_args: Option<Vec<Vec<u8>>>,
) -> Result<Vec<u8>, DatabaseError>
fn read_raw( &self, user_id: i64, read_point_hash: [u8; 16], read_data: &[i64], condition: Option<&[WhereCond]>, condition_args: Option<Vec<Vec<u8>>>, ) -> Result<Vec<u8>, DatabaseError>
Reads the database from raw data.
- user id is the identifier of the host, which might be needed for database access control depending on how the implementor initializes the host.
- read point hash is the identifier of the slot Zephyr is trying to read from the database.
- read data is a slice of integers that define the read instruction that Zephyr is providing to the database implementation
sourcefn write_raw(
&self,
user_id: i64,
written_point_hash: [u8; 16],
write_data: &[i64],
written: Vec<Vec<u8>>,
) -> Result<(), DatabaseError>
fn write_raw( &self, user_id: i64, written_point_hash: [u8; 16], write_data: &[i64], written: Vec<Vec<u8>>, ) -> Result<(), DatabaseError>
Writes the database from raw data.
- user id is the identifier of the host, which might be needed for database access control depending on how the implementor initializes the host.
- written point hash is the identifier of the slot in the database that Zephyr is writing to.
- write data is a slice of integers with instructions about the write operation.
- written is a multidimensional vector with bytes being written as a single value in the database.
sourcefn update_raw(
&self,
user_id: i64,
written_point_hash: [u8; 16],
write_data: &[i64],
written: Vec<Vec<u8>>,
condition: &[WhereCond],
condition_args: Vec<Vec<u8>>,
) -> Result<(), DatabaseError>
fn update_raw( &self, user_id: i64, written_point_hash: [u8; 16], write_data: &[i64], written: Vec<Vec<u8>>, condition: &[WhereCond], condition_args: Vec<Vec<u8>>, ) -> Result<(), DatabaseError>
Updates database rows from raw data.
- user id is the identifier of the host, which might be needed for database access control depending on how the implementor initializes the host.
- written point hash is the identifier of the slot in the database that Zephyr is writing to.
- write data is a slice of integers with instructions about the write operation.
- written is a multidimensional vector with bytes being written as a single value in the database.