pub struct Record<Data> {
pub id: RecordId,
pub idx: RecordIdx,
pub host: Host,
pub timestamp: u64,
pub version: String,
pub tag: String,
pub data: Data,
}
Expand description
A single record stored inside of our local database
Fields§
§id: RecordId
a unique ID
idx: RecordIdx
The integer record ID. This is only unique per (host, tag).
host: Host
The unique ID of the host.
timestamp: u64
The creation time in nanoseconds since unix epoch
version: String
The version the data in the entry conforms to
tag: String
The type of data we are storing here. Eg, “history”
data: Data
Some data. This can be anything you wish to store. Use the tag field to know how to handle it.
Implementations§
Source§impl<Data> Record<Data>
impl<Data> Record<Data>
Sourcepub fn builder() -> RecordBuilder<Data, ((), (), (), (), (), (), ())>
pub fn builder() -> RecordBuilder<Data, ((), (), (), (), (), (), ())>
Create a builder for building Record
.
On the builder, call .id(...)
(optional), .idx(...)
, .host(...)
, .timestamp(...)
(optional), .version(...)
, .tag(...)
, .data(...)
to set the values of the fields.
Finally, call .build()
to create the instance of Record
.
Source§impl Record<DecryptedData>
impl Record<DecryptedData>
pub fn encrypt<E: Encryption>(self, key: &[u8; 32]) -> Record<EncryptedData>
Source§impl Record<EncryptedData>
impl Record<EncryptedData>
pub fn decrypt<E: Encryption>( self, key: &[u8; 32], ) -> Result<Record<DecryptedData>>
pub fn re_encrypt<E: Encryption>( self, old_key: &[u8; 32], new_key: &[u8; 32], ) -> Result<Record<EncryptedData>>
Trait Implementations§
Source§impl<'de, Data> Deserialize<'de> for Record<Data>where
Data: Deserialize<'de>,
impl<'de, Data> Deserialize<'de> for Record<Data>where
Data: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<Data> StructuralPartialEq for Record<Data>
Auto Trait Implementations§
impl<Data> Freeze for Record<Data>where
Data: Freeze,
impl<Data> RefUnwindSafe for Record<Data>where
Data: RefUnwindSafe,
impl<Data> Send for Record<Data>where
Data: Send,
impl<Data> Sync for Record<Data>where
Data: Sync,
impl<Data> Unpin for Record<Data>where
Data: Unpin,
impl<Data> UnwindSafe for Record<Data>where
Data: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more