Class GraphQLMetaStore

java.lang.Object
io.github.qubitpi.athena.metastore.graphql.GraphQLMetaStore
All Implemented Interfaces:
MetaStore

@Singleton @NotThreadSafe public class GraphQLMetaStore extends Object implements MetaStore
The default implementation of MetaStore.

GraphQLMetaStore is basically the Athena's implementation of GraphQL server API.

  • 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 databases
      mutationDataFetcher - An application defined logic for saving/updating file metadata into various databases
      Throws:
      NullPointerException - if queryDataFetcher or mutationDataFetcher is null
  • Method Details

    • executeNative

      public graphql.ExecutionResult executeNative(String query)
      Description copied from interface: MetaStore
      Retrieves a file metadata using a native GraphQL query.
      Specified by:
      executeNative in interface MetaStore
      Parameters:
      query - The query for fetching file metadata
      Returns:
      a metadata object
    • getMetaData

      public graphql.ExecutionResult getMetaData(String fileId, List<String> metadataFields)
      Description copied from interface: MetaStore
      Retrieves a file metadata identified by a specified file ID.
      Specified by:
      getMetaData in interface MetaStore
      Parameters:
      fileId - The provided file ID
      metadataFields - The dynamic set up fields that are returned to the service client
      Returns:
      a metadata object containing all requested metadata fields
    • saveMetaData

      public void saveMetaData(String fileId, MetaData metaData)
      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 interface MetaStore
      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 of FileStore.upload(File) so that the corresponding metadata can be retrieved later by calling MetaStore.getMetaData(String, List)
      metaData - The metadata object that is going to be saved into database