public final class RealAppSyncStore extends java.lang.Object implements ApolloStore, ReadableStore, WriteableStore
ApolloStore.RecordChangeSubscriberNO_APOLLO_STORE| Constructor and Description |
|---|
RealAppSyncStore(NormalizedCache normalizedCache,
CacheKeyResolver cacheKeyResolver,
ScalarTypeAdapters scalarTypeAdapters,
java.util.concurrent.Executor dispatcher,
com.apollographql.apollo.internal.ApolloLogger logger) |
| Modifier and Type | Method and Description |
|---|---|
CacheKeyResolver |
cacheKeyResolver() |
ResponseNormalizer<Record> |
cacheResponseNormalizer() |
GraphQLStoreOperation<java.lang.Boolean> |
clearAll()
Clear all records from this
ApolloStore. |
java.util.Set<java.lang.String> |
merge(java.util.Collection<Record> recordSet,
CacheHeaders cacheHeaders) |
java.util.Set<java.lang.String> |
merge(Record record,
CacheHeaders cacheHeaders) |
ResponseNormalizer<java.util.Map<java.lang.String,java.lang.Object>> |
networkResponseNormalizer() |
NormalizedCache |
normalizedCache() |
void |
publish(java.util.Set<java.lang.String> changedKeys) |
java.util.Collection<Record> |
read(java.util.Collection<java.lang.String> keys,
CacheHeaders cacheHeaders) |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
read(com.apollographql.apollo.api.Operation<D,T,V> operation)
Read GraphQL operation from store.
|
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
read(com.apollographql.apollo.api.Operation<D,T,V> operation,
com.apollographql.apollo.api.ResponseFieldMapper<D> responseFieldMapper,
ResponseNormalizer<Record> responseNormalizer,
CacheHeaders cacheHeaders)
Read GraphQL operation response from store.
|
<F extends com.apollographql.apollo.api.GraphqlFragment> |
read(com.apollographql.apollo.api.ResponseFieldMapper<F> responseFieldMapper,
CacheKey cacheKey,
com.apollographql.apollo.api.Operation.Variables variables)
Read GraphQL fragment from store.
|
Record |
read(java.lang.String key,
CacheHeaders cacheHeaders) |
<R> R |
readTransaction(Transaction<ReadableStore,R> transaction)
Run a operation inside a read-lock.
|
GraphQLStoreOperation<java.lang.Boolean> |
remove(CacheKey cacheKey)
Remove cache record by the key
|
GraphQLStoreOperation<java.lang.Integer> |
remove(java.util.List<CacheKey> cacheKeys)
Remove cache records by the list of keys
|
GraphQLStoreOperation<java.util.Set<java.lang.String>> |
rollbackOptimisticUpdates(java.util.UUID mutationId)
Rollback operation data optimistic updates.
|
GraphQLStoreOperation<java.lang.Boolean> |
rollbackOptimisticUpdatesAndPublish(java.util.UUID mutationId)
Rollback operation data optimistic updates and publish changes of
Records which have changed, that will
notify any AppSyncQueryWatcher that depends on these Record to re-fetch. |
void |
subscribe(ApolloStore.RecordChangeSubscriber subscriber) |
void |
unsubscribe(ApolloStore.RecordChangeSubscriber subscriber) |
GraphQLStoreOperation<java.util.Set<java.lang.String>> |
write(com.apollographql.apollo.api.GraphqlFragment fragment,
CacheKey cacheKey,
com.apollographql.apollo.api.Operation.Variables variables)
Write fragment to the store.
|
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
write(com.apollographql.apollo.api.Operation<D,T,V> operation,
D operationData)
Write operation to the store.
|
GraphQLStoreOperation<java.lang.Boolean> |
writeAndPublish(com.apollographql.apollo.api.GraphqlFragment fragment,
CacheKey cacheKey,
com.apollographql.apollo.api.Operation.Variables variables)
Write fragment to the store and publish changes of
Record which have changed, that will notify any AppSyncQueryWatcher that depends on these Record to re-fetch. |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
writeAndPublish(com.apollographql.apollo.api.Operation<D,T,V> operation,
D operationData)
Write operation to the store and publish changes of
Record which have changed, that will notify any AppSyncQueryWatcher that depends on these Record to re-fetch. |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
writeOptimisticUpdates(com.apollographql.apollo.api.Operation<D,T,V> operation,
D operationData,
java.util.UUID mutationId)
Write operation data to the optimistic store.
|
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
writeOptimisticUpdatesAndPublish(com.apollographql.apollo.api.Operation<D,T,V> operation,
D operationData,
java.util.UUID mutationId)
Write operation data to the optimistic store and publish changes of
Records which have changed, that will
notify any AppSyncQueryWatcher that depends on these Record to re-fetch. |
<R> R |
writeTransaction(Transaction<WriteableStore,R> transaction)
Run a operation inside a write-lock.
|
public RealAppSyncStore(@Nonnull
NormalizedCache normalizedCache,
@Nonnull
CacheKeyResolver cacheKeyResolver,
@Nonnull
ScalarTypeAdapters scalarTypeAdapters,
@Nonnull
java.util.concurrent.Executor dispatcher,
@Nonnull
com.apollographql.apollo.internal.ApolloLogger logger)
public ResponseNormalizer<java.util.Map<java.lang.String,java.lang.Object>> networkResponseNormalizer()
networkResponseNormalizer in interface ApolloStoreResponseNormalizer used to generate normalized records from the network.public ResponseNormalizer<Record> cacheResponseNormalizer()
cacheResponseNormalizer in interface ApolloStoreResponseNormalizer used to generate normalized records from the cache.public void subscribe(ApolloStore.RecordChangeSubscriber subscriber)
subscribe in interface ApolloStorepublic void unsubscribe(ApolloStore.RecordChangeSubscriber subscriber)
unsubscribe in interface ApolloStorepublic void publish(@Nonnull
java.util.Set<java.lang.String> changedKeys)
publish in interface ApolloStorechangedKeys - A set of keys of Record which have changed.@Nonnull public GraphQLStoreOperation<java.lang.Boolean> clearAll()
ApolloStoreApolloStore.clearAll in interface ApolloStoreGraphQLStoreOperation to be performed, that will be resolved with true if all records was
successfully removed, false otherwise@Nonnull public GraphQLStoreOperation<java.lang.Boolean> remove(@Nonnull CacheKey cacheKey)
ApolloStoreremove in interface ApolloStorecacheKey - of record to be removedGraphQLStoreOperation to be performed, that will be resolved with true if record with such key
was successfully removed, false otherwise@Nonnull public GraphQLStoreOperation<java.lang.Integer> remove(@Nonnull java.util.List<CacheKey> cacheKeys)
ApolloStoreremove in interface ApolloStorecacheKeys - keys of records to be removedGraphQLStoreOperation to be performed, that will be resolved with the count of records been removedpublic <R> R readTransaction(Transaction<ReadableStore,R> transaction)
ApolloStorereadTransaction in interface ApolloStoreR - The result type of this read operation.transaction - A code block to run once the read lock is acquired.public <R> R writeTransaction(Transaction<WriteableStore,R> transaction)
ApolloStorewriteTransaction in interface ApolloStoreR - The result type of this write operation.transaction - A code block to run once the write lock is acquired.public NormalizedCache normalizedCache()
normalizedCache in interface ApolloStoreNormalizedCache which backs this ApolloStore.@Nullable public Record read(@Nonnull java.lang.String key, @Nonnull CacheHeaders cacheHeaders)
read in interface ReadableStore@Nonnull public java.util.Collection<Record> read(@Nonnull java.util.Collection<java.lang.String> keys, @Nonnull CacheHeaders cacheHeaders)
read in interface ReadableStore@Nonnull
public java.util.Set<java.lang.String> merge(@Nonnull
java.util.Collection<Record> recordSet,
@Nonnull
CacheHeaders cacheHeaders)
merge in interface WriteableStorepublic java.util.Set<java.lang.String> merge(Record record, @Nonnull CacheHeaders cacheHeaders)
merge in interface WriteableStorepublic CacheKeyResolver cacheKeyResolver()
cacheKeyResolver in interface ApolloStoreCacheKeyResolver used for resolving field cache keys@Nonnull public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> GraphQLStoreOperation<T> read(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation)
ApolloStoreread in interface ApolloStoreD - type of GraphQL operation dataT - type operation cached data will be wrapped withV - type of operation variablesoperation - to be readGraphQLStoreOperation to be performed, that will be resolved with cached data for specified operation@Nonnull public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> GraphQLStoreOperation<com.apollographql.apollo.api.Response<T>> read(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation, @Nonnull com.apollographql.apollo.api.ResponseFieldMapper<D> responseFieldMapper, @Nonnull ResponseNormalizer<Record> responseNormalizer, @Nonnull CacheHeaders cacheHeaders)
ApolloStoreread in interface ApolloStoreD - type of GraphQL operation dataT - type operation cached data will be wrapped withV - type of operation variablesoperation - response of which should be readresponseFieldMapper - ResponseFieldMapper to be used for field mappingresponseNormalizer - ResponseNormalizer to be used when reading cached responsecacheHeaders - CacheHeaders to be used when reading cached responseGraphQLStoreOperation to be performed, that will be resolved with cached response for specified operation@Nonnull public <F extends com.apollographql.apollo.api.GraphqlFragment> GraphQLStoreOperation<F> read(@Nonnull com.apollographql.apollo.api.ResponseFieldMapper<F> responseFieldMapper, @Nonnull CacheKey cacheKey, @Nonnull com.apollographql.apollo.api.Operation.Variables variables)
ApolloStoreread in interface ApolloStoreF - type of fragment to be readresponseFieldMapper - ResponseFieldMapper to be used for field mappingcacheKey - CacheKey to be used to find cache record for the fragmentvariables - Operation.Variables required for fragment arguments resolvingGraphQLStoreOperation to be performed, that will be resolved with cached fragment data@Nonnull public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> GraphQLStoreOperation<java.util.Set<java.lang.String>> write(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation, @Nonnull D operationData)
ApolloStorewrite in interface ApolloStoreD - type of GraphQL operation dataT - type operation cached data will be wrapped withV - type of operation variablesoperation - Operation response data of which should be written to the storeoperationData - Operation.Data operation response data to be written to the storeGraphQLStoreOperation to be performed, that will be resolved with set of keys of Record which
have changed@Nonnull public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> GraphQLStoreOperation<java.lang.Boolean> writeAndPublish(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation, @Nonnull D operationData)
ApolloStoreRecord which have changed, that will notify any AppSyncQueryWatcher that depends on these Record to re-fetch.writeAndPublish in interface ApolloStoreD - type of GraphQL operation dataT - type operation cached data will be wrapped withV - type of operation variablesoperation - Operation response data of which should be written to the storeoperationData - Operation.Data operation response data to be written to the storeGraphQLStoreOperation to be performed@Nonnull public GraphQLStoreOperation<java.util.Set<java.lang.String>> write(@Nonnull com.apollographql.apollo.api.GraphqlFragment fragment, @Nonnull CacheKey cacheKey, @Nonnull com.apollographql.apollo.api.Operation.Variables variables)
ApolloStorewrite in interface ApolloStorefragment - data to be written to the storecacheKey - CacheKey to be used as root record keyvariables - Operation.Variables required for fragment arguments resolvingGraphQLStoreOperation to be performed, that will be resolved with set of keys of Record which
have changed@Nonnull public GraphQLStoreOperation<java.lang.Boolean> writeAndPublish(@Nonnull com.apollographql.apollo.api.GraphqlFragment fragment, @Nonnull CacheKey cacheKey, @Nonnull com.apollographql.apollo.api.Operation.Variables variables)
ApolloStoreRecord which have changed, that will notify any AppSyncQueryWatcher that depends on these Record to re-fetch.writeAndPublish in interface ApolloStorefragment - data to be written to the storecacheKey - CacheKey to be used as root record keyGraphQLStoreOperation to be performed@Nonnull public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> GraphQLStoreOperation<java.util.Set<java.lang.String>> writeOptimisticUpdates(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation, @Nonnull D operationData, @Nonnull java.util.UUID mutationId)
ApolloStorewriteOptimisticUpdates in interface ApolloStoreoperation - Operation response data of which should be written to the storeoperationData - Operation.Data operation response data to be written to the storemutationId - mutation unique identifierGraphQLStoreOperation to be performed, that will be resolved with set of keys of Record which
have changed@Nonnull public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> GraphQLStoreOperation<java.lang.Boolean> writeOptimisticUpdatesAndPublish(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation, @Nonnull D operationData, @Nonnull java.util.UUID mutationId)
ApolloStoreRecords which have changed, that will
notify any AppSyncQueryWatcher that depends on these Record to re-fetch.writeOptimisticUpdatesAndPublish in interface ApolloStoreoperation - Operation response data of which should be written to the storeoperationData - Operation.Data operation response data to be written to the storemutationId - mutation unique identifierGraphQLStoreOperation to be performed@Nonnull public GraphQLStoreOperation<java.util.Set<java.lang.String>> rollbackOptimisticUpdates(@Nonnull java.util.UUID mutationId)
ApolloStorerollbackOptimisticUpdates in interface ApolloStoremutationId - mutation unique identifierGraphQLStoreOperation to be performed@Nonnull public GraphQLStoreOperation<java.lang.Boolean> rollbackOptimisticUpdatesAndPublish(@Nonnull java.util.UUID mutationId)
ApolloStoreRecords which have changed, that will
notify any AppSyncQueryWatcher that depends on these Record to re-fetch.rollbackOptimisticUpdatesAndPublish in interface ApolloStoremutationId - mutation unique identifierGraphQLStoreOperation to be performed, that will be resolved with set of keys of Record which
have changed