/** * Add a chunk to the store. Retry operation several times before failing. * @param chunk the chunk to add * @param meta the chunk's metadata * @param layer the layer the chunk should be added to (may be null) * @param indexMeta metadata specifying how the chunk should be indexed * @return a Completable that will complete when the operation has finished */ protected Completable addToStore(String chunk, ChunkMeta meta, String layer, IndexMeta indexMeta) { return Completable.defer(() -> store.rxAdd(chunk, meta, layer, indexMeta)) .retryWhen(RxUtils.makeRetry(MAX_RETRIES, RETRY_INTERVAL, log)); } }