A feed is an append-only log of objects, such as the messages of a chat or the events of a sync. The feed itself is an
ECHO object of type org.dxos.type.feed, stored in the space like any other. Its items are stored in blocks, apart from the
space’s documents. Feeds explains the model of branches and walks.
A walk reads items in the order they were appended. It is a query with a Scope.feed source and an Order.natural order.
To read a page at a time, pass limit, then select with Filter.feedCursor from the cursor of the last item to get the
page after it. Any filter works over a feed’s items, as over a space, and from(feed) reads every item without walking a
path.
Returns the feed object's EID when the feed is stored in a space.
Private-ish and on track to be removed — prefer resolving feed scopes via higher-level APIs
(e.g. Feed.query) rather than threading the raw queue URI. Used internally by the feed service
layer.
Reads the feed as a walk along the path from the root branch to branch, in local order; select
with
Filter.feedCursor
to start after a local cursor and order with Order.natural for the
direction. 'all' walks every branch in local order. forks also gives the base item of each
branch that forks at a block the walk gives.
Order the query results.
Orders are specified in priority order. The first order will be applied first, etc.
Order.property orders by the current result shape's fields, so it works both before and after
an
aggregate
: before, by member (row) properties; after, by the flat record's fields
(any group or aggregate field — e.g. Order.property('lastMessageAt') reorders the groups by
that aggregate).
@param ― order - Order to sort the results.
@returns ― Query for the ordered results.
@performance ― O(k) in the number of orders; builds the AST without executing anything.
Order by the database's default order. For non-feed sources this is by id; for feed sources
this is insertion order, so desc reads newest-first. Defaults to asc.
@performance ― O(1); builds an order AST node without sorting anything.
@performance ― Async; executes the full query (index plus working set) on every call, not cached; O(n) in the data
the executor examines, not in the result count.
run();
13
14
// The next page: resume after the last item read.
Filter feed items to a cursor range — see Feed.getCursor for reading a cursor off an item, and
Feed.START for the sentinel that bounds nothing.
The range is pushed into the index scan, so a reader that keeps a cursor pays for what is new
rather than for the whole feed. Combine with limit() for a bounded page. Results come back in
append order and cover positioned items only — an item a peer wrote but the position authority
has not yet acknowledged has no place in that order, and Feed.START selects the same set from
the beginning rather than everything. Only meaningful against a feed scope — an automerge object
carries no position, so a query that also selects a space's documents is rejected.
@example
// The next 10 items after the last one this reader consumed.
Reads the feed as a walk along the path from the root branch to branch, in local order; select
with
Filter.feedCursor
to start after a local cursor and order with Order.natural for the
direction. 'all' walks every branch in local order. forks also gives the base item of each
branch that forks at a block the walk gives.
Order the query results.
Orders are specified in priority order. The first order will be applied first, etc.
Order.property orders by the current result shape's fields, so it works both before and after
an
aggregate
: before, by member (row) properties; after, by the flat record's fields
(any group or aggregate field — e.g. Order.property('lastMessageAt') reorders the groups by
that aggregate).
@param ― order - Order to sort the results.
@returns ― Query for the ordered results.
@performance ― O(k) in the number of orders; builds the AST without executing anything.
Order by the database's default order. For non-feed sources this is by id; for feed sources
this is insertion order, so desc reads newest-first. Defaults to asc.
@performance ― O(1); builds an order AST node without sorting anything.
natural('asc'))
26
.
Query<any>.limit(limit: number): Query.Query<any>
Limit the number of results.
@param ― limit - Maximum number of results to return.
@returns ― Query for the limited results.
@performance ― O(1); wraps the current AST in a new immutable node without executing anything.
@performance ― Async; executes the full query (index plus working set) on every call, not cached; O(n) in the data
the executor examines, not in the result count.
@performance ― Async; executes the full query (index plus working set) on every call, not cached; O(n) in the data
the executor examines, not in the result count.
indexing: { enabled: false } turns indexing of the feed’s items off completely. There is no partial mode.
org.dxos.echo#F-7.2
retention drops items past maxLength items or older than maxAge milliseconds. With both set, an item goes when it
breaks either limit. org.dxos.echo#F-7.3
A write returns once the change is applied locally. It does not wait for the feed store to trim anything.
Perform mutations on an echo object within a controlled context.
All mutations within the callback are batched and trigger a single notification
when the callback completes. Direct mutations outside of Obj.update will throw
an error for echo objects.
This function also works with nested objects within echo objects (e.g., Template structs)
that are reactive at runtime.
@param ― obj - The echo object to mutate. Use Relation.update for relations.
@param ― callback - The callback that performs mutations on the object.
@example
const person = Obj.make(Person, { name: 'John', age: 25 });
A fork starts a branch at an existing item, for example an alternate reply in a conversation. db.forkFeed returns the
branch id. Walk with { branch } to read the path from the start of the feed to the end of that branch.
Appends base as the base block of a new branch of the feed, with the fork point at (an item,
at the block it was read from, or a block id) as its predecessor. Resolves to the id of the new
branch, the block id of the base, once the base is written.
Reads the feed as a walk along the path from the root branch to branch, in local order; select
with
Filter.feedCursor
to start after a local cursor and order with Order.natural for the
direction. 'all' walks every branch in local order. forks also gives the base item of each
branch that forks at a block the walk gives.
Order the query results.
Orders are specified in priority order. The first order will be applied first, etc.
Order.property orders by the current result shape's fields, so it works both before and after
an
aggregate
: before, by member (row) properties; after, by the flat record's fields
(any group or aggregate field — e.g. Order.property('lastMessageAt') reorders the groups by
that aggregate).
@param ― order - Order to sort the results.
@returns ― Query for the ordered results.
@performance ― O(k) in the number of orders; builds the AST without executing anything.
Order by the database's default order. For non-feed sources this is by id; for feed sources
this is insertion order, so desc reads newest-first. Defaults to asc.
@performance ― O(1); builds an order AST node without sorting anything.
@performance ― Async; executes the full query (index plus working set) on every call, not cached; O(n) in the data
the executor examines, not in the result count.