Skip to content

Commit bc0fbed

Browse files
authored
Merge pull request #341 from ably/objects-access-api
Add Objects Access API spec
2 parents 7db45b1 + c756951 commit bc0fbed

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

src/objects-features.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,60 @@ the latest state.
228228
- `(RTLM5d2f2)` If an object with id `objectId` exists, return
229229
it
230230
- `(RTLM5d2g)` Otherwise, return undefined/null
231+
- `(RTLM10)` `LiveMap#size`:
232+
- `(RTLM10a)` A method or property, depending on what is more
233+
idiomatic for the platform to use for a Map/Dictionary interface.
234+
For example, in JavaScript, this is a property similar to `Map.size`
235+
for the native `Map` class
236+
- `(RTLM10b)` Requires the `OBJECT_SUBSCRIBE` channel mode to be
237+
granted per [RTO2](#RTO2)
238+
- `(RTLM10c)` If the channel is in the `DETACHED` or `FAILED` state,
239+
the library should throw an `ErrorInfo` error with `statusCode` 400
240+
and `code` 90001
241+
- `(RTLM10d)` Returns the number of non-tombstoned entries (per
242+
[RTLM14](#RTLM14)) in the internal `data` map
243+
- `(RTLM11)` `LiveMap#entries`:
244+
- `(RTLM11a)` A method or property, depending on what is more
245+
idiomatic for the platform to use for a Map/Dictionary interface.
246+
For example, in JavaScript, this is a method similar to
247+
`Map.entries()` for the native `Map` class
248+
- `(RTLM11b)` Requires the `OBJECT_SUBSCRIBE` channel mode to be
249+
granted per [RTO2](#RTO2)
250+
- `(RTLM11c)` If the channel is in the `DETACHED` or `FAILED` state,
251+
the library should throw an `ErrorInfo` error with `statusCode` 400
252+
and `code` 90001
253+
- `(RTLM11d)` Returns key-value pairs from the internal `data` map:
254+
- `(RTLM11d1)` Pairs with tombstoned entries (per [RTLM14](#RTLM14))
255+
are not returned
256+
- `(RTLM11d3)` `ObjectsMapEntry` values are mapped to user-facing
257+
values following the same procedure as in [RTLM5d2](#RTLM5d2)
258+
- `(RTLM11d3a)` Note that if [RTLM5d2](#RTLM5d2) results in an
259+
`ObjectsMapEntry` being mapped to an undefined/null value, the
260+
corresponding key-value pair is still returned by this
261+
`LiveMap#entries` call
262+
- `(RTLM11d2)` The return type is idiomatic for the platform’s
263+
analogous Map/Dictionary interface operation. For example, in
264+
JavaScript, it returns a map iterator object like the one returned
265+
by `Map.entries()` method for the native `Map` class
266+
- `(RTLM12)` `LiveMap#keys`:
267+
- `(RTLM12a)` A method or property, depending on what is more
268+
idiomatic for the platform to use for a Map/Dictionary interface.
269+
For example, in JavaScript, this is a method similar to `Map.keys()`
270+
for the native `Map` class
271+
- `(RTLM12b)` The implementation is identical to `LiveMap#entries`,
272+
except that it returns only the keys from the internal `data` map
273+
- `(RTLM13)` `LiveMap#values`:
274+
- `(RTLM13a)` A method or property, depending on what is more
275+
idiomatic for the platform to use for a Map/Dictionary interface.
276+
For example, in JavaScript, this is a method similar to
277+
`Map.values()` for the native `Map` class
278+
- `(RTLM13b)` The implementation is identical to `LiveMap#entries`,
279+
except that it returns only the values from the internal `data` map
280+
- `(RTLM14)` An `ObjectsMapEntry` in the internal `data` map can be
281+
checked for being tombstoned using the convenience method:
282+
- `(RTLM14a)` The method returns true if `ObjectsMapEntry.tombstone`
283+
is true
284+
- `(RTLM14b)` Otherwise, it returns false
231285
- `(RTLM6)` `LiveMap` internal `data` can be replaced with the provided
232286
`ObjectState` in the following way:
233287
- `(RTLM6a)` Replace the private `siteTimeserials` of the `LiveMap`

0 commit comments

Comments
 (0)