pub struct Note<'a, IOM: Write<SevenBitAddress> + Read<SevenBitAddress>, const BS: usize> { /* private fields */ }Implementations§
Source§impl<'a, IOM: Write<SevenBitAddress> + Read<SevenBitAddress>, const BS: usize> Note<'a, IOM, BS>
impl<'a, IOM: Write<SevenBitAddress> + Read<SevenBitAddress>, const BS: usize> Note<'a, IOM, BS>
pub fn from(note: &mut Notecard<IOM, BS>) -> Note<'_, IOM, BS>
Sourcepub fn add<T: Serialize + Default>(
self,
delay: &mut impl DelayMs<u16>,
file: Option<&str>,
note: Option<&str>,
body: Option<T>,
payload: Option<&str>,
sync: bool,
) -> Result<FutureResponse<'a, Add, IOM, BS>, NoteError>
pub fn add<T: Serialize + Default>( self, delay: &mut impl DelayMs<u16>, file: Option<&str>, note: Option<&str>, body: Option<T>, payload: Option<&str>, sync: bool, ) -> Result<FutureResponse<'a, Add, IOM, BS>, NoteError>
Adds a note to a notefile, creating the Notefile if it doesn’t yet exist. When sending this request to the Notecard, if a Notefile name is specified, the file must either be a DB Notefile or outbound queue file (.qo/.qos). When sending this request to Notehub, the file must either be a DB Notefile or an inbound queue file (.qi/.qis).
If you don’t use a template the size of the payload is maximum 250 bytes, with a template 8KB seems to work.
Sourcepub fn update<T: Serialize + Default>(
self,
delay: &mut impl DelayMs<u16>,
file: &str,
note: &str,
body: Option<T>,
payload: Option<&str>,
verify: bool,
) -> Result<FutureResponse<'a, Empty, IOM, BS>, NoteError>
pub fn update<T: Serialize + Default>( self, delay: &mut impl DelayMs<u16>, file: &str, note: &str, body: Option<T>, payload: Option<&str>, verify: bool, ) -> Result<FutureResponse<'a, Empty, IOM, BS>, NoteError>
Updates a Note in a DB Notefile by its ID, replacing the existing body and/or payload.
Sourcepub fn get<T: DeserializeOwned + Serialize>(
self,
delay: &mut impl DelayMs<u16>,
file: &str,
note: &str,
delete: bool,
deleted: bool,
) -> Result<FutureResponse<'a, Get<T>, IOM, BS>, NoteError>
pub fn get<T: DeserializeOwned + Serialize>( self, delay: &mut impl DelayMs<u16>, file: &str, note: &str, delete: bool, deleted: bool, ) -> Result<FutureResponse<'a, Get<T>, IOM, BS>, NoteError>
Retrieves a Note from a Notefile.
- When sending this request to the Notecard, the file must either be a DB Notefile (.db or .dbx) or inbound queue file (.qi/.qis).
- When sending this request to Notehub, the file must be a DB Notefile (.db).
.qo/.qos Notes must be read from the Notehub event table using the Notehub Event API.
Sourcepub fn delete(
self,
delay: &mut impl DelayMs<u16>,
file: &str,
note: &str,
) -> Result<FutureResponse<'a, Empty, IOM, BS>, NoteError>
pub fn delete( self, delay: &mut impl DelayMs<u16>, file: &str, note: &str, ) -> Result<FutureResponse<'a, Empty, IOM, BS>, NoteError>
Deletes Notefiles from a DB Notefile by its Note ID. To delete Notes from a .qi Notefile, use note.get or note.changes with delete:true.
Sourcepub fn template<T: Serialize + Default>(
self,
delay: &mut impl DelayMs<u16>,
file: Option<&str>,
body: Option<T>,
length: Option<u32>,
format: TemplateFormat,
port: Option<u32>,
delete: Option<bool>,
) -> Result<FutureResponse<'a, Template, IOM, BS>, NoteError>
pub fn template<T: Serialize + Default>( self, delay: &mut impl DelayMs<u16>, file: Option<&str>, body: Option<T>, length: Option<u32>, format: TemplateFormat, port: Option<u32>, delete: Option<bool>, ) -> Result<FutureResponse<'a, Template, IOM, BS>, NoteError>
Using the note.template request command with any .qo/.qos Notefile, developers can provide the Notecard with a schema of sorts to apply to future Notes added to the Notefile. This template acts as a hint to the Notecard that allows it to internally store data as fixed-length binary records rather than as flexible JSON objects which require much more memory. Using templated Notes in place of regular Notes increases the storage and sync capability of the Notecard by an order of magnitude.
See https://dev.blues.io/notecard/notecard-walkthrough/low-bandwidth-design/#understanding-template-data-types for the format and values of the template.