Struct wallabag_backend::Backend
source · pub struct Backend { /* private fields */ }
Implementations
sourceimpl Backend
impl Backend
pub fn new_with_conf(conf: Config) -> Fallible<Self>
pub fn reset(&self) -> Fallible<()>
pub fn init(&self) -> Fallible<()>
sourcepub fn get_entry<T: Into<ID>>(&self, id: T) -> Fallible<Option<Entry>>
pub fn get_entry<T: Into<ID>>(&self, id: T) -> Fallible<Option<Entry>>
Get a Vec of tags from the db.
Get a Vec of tags from the db.
sourcepub fn add_url_online<T: AsRef<str>>(&mut self, url: T) -> Fallible<()>
pub fn add_url_online<T: AsRef<str>>(&mut self, url: T) -> Fallible<()>
Add a new url and attempts to upload and create entry immediatedly. Fails if network connection down.
sourcepub fn add_url<T: AsRef<str>>(&self, url: T) -> Fallible<()>
pub fn add_url<T: AsRef<str>>(&self, url: T) -> Fallible<()>
Add a new url. Does not attempt to upload immediately.
sourcepub fn full_sync(&mut self) -> Fallible<()>
pub fn full_sync(&mut self) -> Fallible<()>
Full sync. Can be slow if many articles. This will sync everything, including things that can’t be synced with a quick/normal sync (eg. server-side deleted items)
For entries and annotations existing in the database, object with latest updated_at value wins.
Tags are tied to Entries, even though the tags will also have seperate db tables dedicated to them. An updated tag should mean an updated updated_at field in an entry.
NOTE: changing tags on an entry touches updated_at. To add a tag
locally, create a new tag object with an arbitrary slug
and id
,
add it to the Entry object, and save to db. taglinks and tags table
will be updated in next sync.
NOTE: changing an annotation does not update entry updated_at
sourcepub fn sync(&mut self) -> Fallible<()>
pub fn sync(&mut self) -> Fallible<()>
Normal sync. Syncs everything changed since the last sync, with the exception of deleted entries and annotations (syncing deletes requires a full sweep through everything).
For entries and annotations existing in the database, object with latest updated_at value wins.
What this does not sync:
- Entries deleted server-side.
- Annotations deleted server-side.
- Annotations updated or created server-side that are not associated with entries updated since previous sync. (ie. recently updated annotations on non-recently updated entries)
TODO: ignore errors relating to actions that have already been done - eg. 404 error on client delete entry.