CollectionImpl
Internal implementation of the Collection abstract. Handles the actual storage, indexing, and management of collection entries.
Instance Members
entries: ReadOnlyArray<ceramic.CollectionImpl.T>The array of entries in the collection. Read-only access from outside the class.
length: IntThe number of entries in the collection.
Adds multiple entries to the collection at once.
| Name | Type | Description |
|---|---|---|
entries |
Array<ceramic.CollectionImpl.T> | Array of entries to add |
clear(): VoidRemoves all entries from the collection.
push(entry: ceramic.CollectionImpl.T): VoidAdds a single entry to the collection.
| Name | Type | Description |
|---|---|---|
entry |
ceramic.CollectionImpl.T | The entry to add |
remove(entry: ceramic.CollectionImpl.T): VoidRemoves an entry from the collection.
| Name | Type | Description |
|---|---|---|
entry |
ceramic.CollectionImpl.T | The entry to remove |
synchronize(): VoidForces immediate synchronization of the collection's internal state. Normally done automatically when accessing entries.
get(id: String): ceramic.CollectionImpl.TGets an entry by its ID.
| Name | Type | Description |
|---|---|---|
id |
String | The ID of the entry to retrieve |
| Returns | Description |
|---|---|
| ceramic.CollectionImpl.T | The entry with the given ID, or null if not found |
getByIndex(index: Int): ceramic.CollectionImpl.TGets an entry by its index in the collection.
| Name | Type | Description |
|---|---|---|
index |
Int | The index of the entry |
| Returns | Description |
|---|---|
| ceramic.CollectionImpl.T | The entry at the given index |
Gets the index of an entry by its ID.
| Name | Type | Description |
|---|---|---|
id |
String | The ID to search for |
| Returns | Description |
|---|---|
| Int | The index of the entry, or -1 if not found |
indexOf(entry: ceramic.CollectionImpl.T): IntGets the index of an entry in the collection.
| Name | Type | Description |
|---|---|---|
entry |
ceramic.CollectionImpl.T | The entry to find |
| Returns | Description |
|---|---|
| Int | The index of the entry, or -1 if not found |
iterator(): IteratorReturns an iterator for the collection. Enables for-in loop iteration.
| Returns | Description |
|---|---|
| Iterator | An iterator over the collection entries |
new(): VoidPrivate Members
internalId: IntlastChange: IntindexDirty: BoolWhether the ID index needs to be rebuilt
entriesDirty: BoolWhether combined entries need to be recomputed
byId: MapMap for fast lookup by ID
combinedCollections: Array<CollectionImpl<ceramic.CollectionImpl.T>>Collections being combined into this one
Track changes in combined collections
filter(): Array<ceramic.CollectionImpl.T>Optional filter function for combined collections
| Returns |
|---|
| Array<ceramic.CollectionImpl.T> |
checkCombined(): VoidcomputeIndex(): VoidcomputeEntries(): VoidMetadata
| Name | Parameters |
|---|---|
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:allow |
ceramic.Collection |
:allow |
ceramic.CollectionUtils |