Class GraphQLMetaStore
java.lang.Object
io.github.qubitpi.athena.metastore.graphql.GraphQLMetaStore
- All Implemented Interfaces:
MetaStore
The default implementation of
MetaStore
.
GraphQLMetaStore
is basically the Athena's implementation of GraphQL server API.
-
Constructor Summary
ConstructorDescriptionGraphQLMetaStore
(@NotNull graphql.schema.DataFetcher<MetaData> queryDataFetcher, @NotNull graphql.schema.DataFetcher<MetaData> mutationDataFetcher) DI constructor. -
Method Summary
Modifier and TypeMethodDescriptiongraphql.ExecutionResult
executeNative
(String query) Retrieves a file metadata using a native GraphQL query.graphql.ExecutionResult
getMetaData
(String fileId, List<String> metadataFields) Retrieves a file metadata identified by a specified file ID.void
saveMetaData
(String fileId, MetaData metaData) Persists a file metadata into database.
-
Constructor Details
-
GraphQLMetaStore
@Inject public GraphQLMetaStore(@NotNull @Named("queryDataFetcher") @NotNull graphql.schema.DataFetcher<MetaData> queryDataFetcher, @NotNull @Named("mutationDataFetcher") @NotNull graphql.schema.DataFetcher<MetaData> mutationDataFetcher) DI constructor.- Parameters:
queryDataFetcher
- An application defined logic for retrieving file metadata from various databasesmutationDataFetcher
- An application defined logic for saving/updating file metadata into various databases- Throws:
NullPointerException
- ifqueryDataFetcher
ormutationDataFetcher
isnull
-
-
Method Details
-
executeNative
Description copied from interface:MetaStore
Retrieves a file metadata using a native GraphQL query.- Specified by:
executeNative
in interfaceMetaStore
- Parameters:
query
- The query for fetching file metadata- Returns:
- a metadata object
-
getMetaData
Description copied from interface:MetaStore
Retrieves a file metadata identified by a specified file ID.- Specified by:
getMetaData
in interfaceMetaStore
- Parameters:
fileId
- The provided file IDmetadataFields
- The dynamic set up fields that are returned to the service client- Returns:
- a metadata object containing all requested metadata fields
-
saveMetaData
Description copied from interface:MetaStore
Persists a file metadata into database.The implementation does NOT have to be thread-safe.
MetaStore
assumes that it is the callers' responsibilities to implement the thread safety themselves.- Specified by:
saveMetaData
in interfaceMetaStore
- Parameters:
fileId
- The ID of the file that has already been uploaded to object storage. The value of the ID must be the return value ofFileStore.upload(File)
so that the corresponding metadata can be retrieved later by callingMetaStore.getMetaData(String, List)
metaData
- The metadata object that is going to be saved into database
-