Offline availability management for workspace content
Offline availability management for workspace content systems is disclosed. A system receives requests identifying database objects for offline availability. The system inserts entries into a first data structure identifying the object, and inserts lists into a second data structure indicating conditions for offline availability. Lists include an origin identifier for the initiating object, a source identifier for intermediate propagation objects, and an object identifier for the offline-available object. For collection views, the system inserts additional entries identifying displayed pages and lists indicating offline availability initiated by the collection view. The system stores object content data in a locally persisted data store and, as needed, loads it into memory for offline access by the client.
1 . A non-transitory, computer-readable storage medium comprising instructions recorded thereon, wherein the instructions, when executed by at least one data processor of a system, cause the system to:
receive a request identifying a particular object of a database system to be made available offline;
in response to receiving the request:
insert, into a first data structure stored in a memory of the system, a first entry identifying the particular object; and
insert, into a second data structure stored in the memory of the system, a first list indicating a condition causing the particular object to be made available offline, wherein the first list comprises:
an origin identifier identifying an origin object of the database system that initiated offline availability of the particular object,
a source identifier identifying an intermediate object of the database system through which offline availability of the particular object propagates, and
an object identifier identifying the particular object as available offline;
in response to the particular object being a collection view:
insert, into the first data structure, a second entry identifying a page displayed by the collection view; and
insert, into the second data structure, a second list indicating that offline availability of the page was initiated by offline availability of the collection view; and
store, in the memory of the system, content data of the particular object for offline access by the system.
2 . The non-transitory, computer-readable storage medium of claim 1 , wherein a plurality of second lists are associated with the particular object, and
wherein the particular object remains available offline while at least one of the plurality of second lists is present in the second data structure.
3 . The non-transitory, computer-readable storage medium of claim 1 , wherein the system is caused to:
determine a count of a number of first lists in which the particular object is identified as the object identifier,
wherein each of the first lists is associated with a different parent object that caused the particular object to be made available offline; and
remove the first entry and the content data of the particular object from the memory of the system in response to determining that the count equals zero.
4 . The non-transitory, computer-readable storage medium of claim 1 , wherein the system is caused to:
synchronize the first data structure and the second data structure with a server by transmitting, to the server, an update to at least one of:
the first or second entries, or
the first or second lists; and
synchronize the particular object with a server by transmitting, to the server, an update to the content data.
5 . The non-transitory, computer-readable storage medium of claim 1 , wherein the request toggles an offline availability state of the particular object.
6 . The non-transitory, computer-readable storage medium of claim 1 , wherein the request is generated by the system in accordance with a synchronization policy.
7 . The non-transitory, computer-readable storage medium of claim 1 , wherein the source identifier identifies at most one collection view.
8 . A system comprising:
at least one hardware processor; and
at least one non-transitory computer-readable storage medium storing instructions, which, when executed by the at least one hardware processor, cause the system to:
maintain, in a memory of the system, an entry indicating that a particular object of a database system is available offline;
maintain, in the memory of the system, one or more lists indicating one or more conditions causing the particular object to be available offline;
receive a request to remove the particular object from offline availability;
remove, from the memory of the system, a list of the one or more lists, wherein the list comprises:
an origin identifier identifying an origin object of the database system that initiated offline availability of the particular object, wherein the origin identifier is associated with the request,
a source identifier identifying an intermediate object of the database system through which offline availability of the particular object propagated, and
an object identifier identifying the particular object as offline;
determine whether the one or more lists have been removed from the memory of the system;
in response to determining that the one or more lists have been removed:
remove, from the memory of the system, the entry; and
remove, from the memory of the system, content data of the particular object.
9 . The system of claim 8 , wherein determining whether the one or more lists have been removed comprises:
determining a count a number of the one or more lists in which the particular object is identified as the object identifier,
wherein each of the one or more lists is associated with a different parent object that caused the particular object to be made available offline, and
wherein the entry and the content data of the particular object are removed from the memory of the system in response to determining that the count equals zero.
10 . The system of claim 8 , wherein the particular object is a collection view, and
wherein the system is caused to:
remove, from the memory of the system, a second entry identifying a page displayed by the collection view; and
remove, from the memory of the system, a second list indicating that offline availability of the page was initiated by offline availability of the collection view.
11 . The system of claim 8 , wherein the system is caused to:
synchronize the entry and the one or more lists with a server using idempotent and commutative updates,
wherein the entry and the one or more lists are synchronized with the server regardless of a number of times the updates are received or an order in which the updates are applied to the server.
12 . The system of claim 8 , wherein the entry is associated with a state machine comprising states including a downloadable state and an available state, and
wherein the system transitions a state of the entry from the downloadable state to the available state in response to storing the content data of the particular object in the memory of the system.
13 . The system of claim 8 , wherein the system is caused to:
in response to a refetch operation associated with the particular object:
limit propagation of offline availability of the particular object by updating the one or more lists to prevent the list from establishing an inconsistent chain of collection view references.
14 . The system of claim 8 , wherein the system is caused to:
In response to removing the particular object from offline availability, remove, from the memory of the system, another list associating the particular object with another object,
wherein the other object remains available offline based on an autosync condition applied to the other object, and
wherein the other object is removed from offline availability in absence of the autosync condition.
15 . A method comprising:
receiving, at a system, a request identifying a particular object of a database system to be made available offline;
in response to receiving the request:
inserting, into a first data structure stored in a memory of the system, a first entry identifying the particular object; and
inserting, into a second data structure stored in the memory of the system, a first list indicating a condition causing the particular object to be made available offline,
wherein the first list identifies (1) an origin object of the database system that initiated offline availability of the particular object, (2) an intermediate object of the database system through which offline availability of the particular object propagates, and (3) the particular object as available offline;
in response to the particular object being a collection view:
inserting, into the first data structure, a second entry identifying a page displayed by the collection view; and
inserting, into the second data structure, a second list indicating that offline availability of the page was initiated by offline availability of the collection view; and
storing, in the memory of the system, content data of the particular object for offline access by the system.
16 . The method of claim 15 , comprising:
enforcing a depth limit when propagating offline availability from the origin object to the particular object to prevent infinite recursion of offline availability of the particular object.
17 . The method of claim 15 , comprising:
determining a count of a number of first lists in which the particular object is identified as the object identifier,
wherein each of the first lists is associated with a different parent object that caused the particular object to be made available offline; and
removing the first entry and the content data of the particular object from the memory of the system in response to determining that the count equals zero.
18 . The method of claim 15 , comprising:
synchronizing the first data structure and the second data structure with a server by transmitting, to the server, an update to at least one of:
the first or second entries, or
the first or second lists; and
synchronizing the particular object with a server by transmitting, to the server, an update to the content data.
19 . The method of claim 15 , wherein the request toggles an offline availability state of the particular object.
20 . The method of claim 15 , wherein the request is generated by the system in accordance with a synchronization policy.