@@ -109,10 +109,13 @@ subscriber callbacks receive the data in a different format than they normally e
109109<dt ><a href =" #remove " >remove()</a ></dt >
110110<dd ><p >Remove a key from Onyx and update the subscribers</p >
111111</dd >
112- <dt ><a href =" #evictStorageAndRetry " >evictStorageAndRetry()</a ></dt >
113- <dd ><p >If we fail to set or merge we must handle this by
114- evicting some data from Onyx and then retrying to do
115- whatever it is we attempted to do.</p >
112+ <dt ><a href =" #retryOperation " >retryOperation()</a ></dt >
113+ <dd ><p >Handles storage operation failures based on the error type:</p >
114+ <ul >
115+ <li >Storage capacity errors: evicts data and retries the operation</li >
116+ <li >Invalid data errors: logs an alert and throws an error</li >
117+ <li >Other errors: retries the operation</li >
118+ </ul >
116119</dd >
117120<dt ><a href =" #broadcastUpdate " >broadcastUpdate()</a ></dt >
118121<dd ><p >Notifies subscribers and writes current value to cache</p >
@@ -147,14 +150,31 @@ It will also mark deep nested objects that need to be entirely replaced during t
147150<dt ><a href =" #unsubscribeFromKey " >unsubscribeFromKey(subscriptionID)</a ></dt >
148151<dd ><p >Disconnects and removes the listener from the Onyx key.</p >
149152</dd >
150- <dt ><a href =" #mergeCollectionWithPatches " >mergeCollectionWithPatches(collectionKey, collection, mergeReplaceNullPatches)</a ></dt >
153+ <dt ><a href =" #setWithRetry " >setWithRetry(params, retryAttempt)</a ></dt >
154+ <dd ><p >Writes a value to our store with the given key.
155+ Serves as core implementation for <code >Onyx.set()</code > public function, the difference being
156+ that this internal function allows passing an additional <code >retryAttempt</code > parameter to retry on failure.</p >
157+ </dd >
158+ <dt ><a href =" #multiSetWithRetry " >multiSetWithRetry(data, retryAttempt)</a ></dt >
159+ <dd ><p >Sets multiple keys and values.
160+ Serves as core implementation for <code >Onyx.multiSet()</code > public function, the difference being
161+ that this internal function allows passing an additional <code >retryAttempt</code > parameter to retry on failure.</p >
162+ </dd >
163+ <dt ><a href =" #setCollectionWithRetry " >setCollectionWithRetry(params, retryAttempt)</a ></dt >
164+ <dd ><p >Sets a collection by replacing all existing collection members with new values.
165+ Any existing collection members not included in the new data will be removed.
166+ Serves as core implementation for <code >Onyx.setCollection()</code > public function, the difference being
167+ that this internal function allows passing an additional <code >retryAttempt</code > parameter to retry on failure.</p >
168+ </dd >
169+ <dt ><a href =" #mergeCollectionWithPatches " >mergeCollectionWithPatches(params, retryAttempt)</a ></dt >
151170<dd ><p >Merges a collection based on their keys.
152171Serves as core implementation for <code >Onyx.mergeCollection()</code > public function, the difference being
153- that this internal function allows passing an additional <code >mergeReplaceNullPatches</code > parameter.</p >
172+ that this internal function allows passing an additional <code >mergeReplaceNullPatches</code > parameter and retries on failure .</p >
154173</dd >
155- <dt ><a href =" #partialSetCollection " >partialSetCollection(collectionKey, collection )</a ></dt >
174+ <dt ><a href =" #partialSetCollection " >partialSetCollection(params, retryAttempt )</a ></dt >
156175<dd ><p >Sets keys in a collection by replacing all targeted collection members with new values.
157- Any existing collection members not included in the new data will not be removed.</p >
176+ Any existing collection members not included in the new data will not be removed.
177+ Retries on failure.</p >
158178</dd >
159179<dt ><a href =" #clearOnyxUtilsInternals " >clearOnyxUtilsInternals()</a ></dt >
160180<dd ><p >Clear internal variables used in this file, useful in test environments.</p >
@@ -406,12 +426,13 @@ subscriber callbacks receive the data in a different format than they normally e
406426Remove a key from Onyx and update the subscribers
407427
408428** Kind** : global function
409- <a name =" evictStorageAndRetry " ></a >
429+ <a name =" retryOperation " ></a >
410430
411- ## evictStorageAndRetry()
412- If we fail to set or merge we must handle this by
413- evicting some data from Onyx and then retrying to do
414- whatever it is we attempted to do.
431+ ## retryOperation()
432+ Handles storage operation failures based on the error type:
433+ - Storage capacity errors: evicts data and retries the operation
434+ - Invalid data errors: logs an alert and throws an error
435+ - Other errors: retries the operation
415436
416437** Kind** : global function
417438<a name =" broadcastUpdate " ></a >
@@ -507,33 +528,87 @@ Disconnects and removes the listener from the Onyx key.
507528| --- | --- |
508529| subscriptionID | Subscription ID returned by calling ` OnyxUtils.subscribeToKey() ` . |
509530
531+ <a name =" setWithRetry " ></a >
532+
533+ ## setWithRetry(params, retryAttempt)
534+ Writes a value to our store with the given key.
535+ Serves as core implementation for ` Onyx.set() ` public function, the difference being
536+ that this internal function allows passing an additional ` retryAttempt ` parameter to retry on failure.
537+
538+ ** Kind** : global function
539+
540+ | Param | Description |
541+ | --- | --- |
542+ | params | set parameters |
543+ | params.key | ONYXKEY to set |
544+ | params.value | value to store |
545+ | params.options | optional configuration object |
546+ | retryAttempt | retry attempt |
547+
548+ <a name =" multiSetWithRetry " ></a >
549+
550+ ## multiSetWithRetry(data, retryAttempt)
551+ Sets multiple keys and values.
552+ Serves as core implementation for ` Onyx.multiSet() ` public function, the difference being
553+ that this internal function allows passing an additional ` retryAttempt ` parameter to retry on failure.
554+
555+ ** Kind** : global function
556+
557+ | Param | Description |
558+ | --- | --- |
559+ | data | object keyed by ONYXKEYS and the values to set |
560+ | retryAttempt | retry attempt |
561+
562+ <a name =" setCollectionWithRetry " ></a >
563+
564+ ## setCollectionWithRetry(params, retryAttempt)
565+ Sets a collection by replacing all existing collection members with new values.
566+ Any existing collection members not included in the new data will be removed.
567+ Serves as core implementation for ` Onyx.setCollection() ` public function, the difference being
568+ that this internal function allows passing an additional ` retryAttempt ` parameter to retry on failure.
569+
570+ ** Kind** : global function
571+
572+ | Param | Description |
573+ | --- | --- |
574+ | params | collection parameters |
575+ | params.collectionKey | e.g. ` ONYXKEYS.COLLECTION.REPORT ` |
576+ | params.collection | Object collection keyed by individual collection member keys and values |
577+ | retryAttempt | retry attempt |
578+
510579<a name =" mergeCollectionWithPatches " ></a >
511580
512- ## mergeCollectionWithPatches(collectionKey, collection, mergeReplaceNullPatches )
581+ ## mergeCollectionWithPatches(params, retryAttempt )
513582Merges a collection based on their keys.
514583Serves as core implementation for ` Onyx.mergeCollection() ` public function, the difference being
515- that this internal function allows passing an additional ` mergeReplaceNullPatches ` parameter.
584+ that this internal function allows passing an additional ` mergeReplaceNullPatches ` parameter and retries on failure .
516585
517586** Kind** : global function
518587
519588| Param | Description |
520589| --- | --- |
521- | collectionKey | e.g. ` ONYXKEYS.COLLECTION.REPORT ` |
522- | collection | Object collection keyed by individual collection member keys and values |
523- | mergeReplaceNullPatches | Record where the key is a collection member key and the value is a list of tuples that we'll use to replace the nested objects of that collection member record with something else. |
590+ | params | mergeCollection parameters |
591+ | params.collectionKey | e.g. ` ONYXKEYS.COLLECTION.REPORT ` |
592+ | params.collection | Object collection keyed by individual collection member keys and values |
593+ | params.mergeReplaceNullPatches | Record where the key is a collection member key and the value is a list of tuples that we'll use to replace the nested objects of that collection member record with something else. |
594+ | params.isProcessingCollectionUpdate | whether this is part of a collection update operation. |
595+ | retryAttempt | retry attempt |
524596
525597<a name =" partialSetCollection " ></a >
526598
527- ## partialSetCollection(collectionKey, collection )
599+ ## partialSetCollection(params, retryAttempt )
528600Sets keys in a collection by replacing all targeted collection members with new values.
529601Any existing collection members not included in the new data will not be removed.
602+ Retries on failure.
530603
531604** Kind** : global function
532605
533606| Param | Description |
534607| --- | --- |
535- | collectionKey | e.g. ` ONYXKEYS.COLLECTION.REPORT ` |
536- | collection | Object collection keyed by individual collection member keys and values |
608+ | params | collection parameters |
609+ | params.collectionKey | e.g. ` ONYXKEYS.COLLECTION.REPORT ` |
610+ | params.collection | Object collection keyed by individual collection member keys and values |
611+ | retryAttempt | retry attempt |
537612
538613<a name =" clearOnyxUtilsInternals " ></a >
539614
0 commit comments