Package io.apicurio.registry.storage
Interface RegistryStorage
-
- All Known Implementing Classes:
AbstractRegistryStorage
,AbstractSqlRegistryStorage
,EventSourcedRegistryStorage
,InMemoryRegistryStorage
public interface RegistryStorage
The artifactStore layer for the registry.- Author:
- eric.wittmann@gmail.com, Ales Justin
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletionStage<ArtifactMetaDataDto>
createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content)
Creates a new artifact (from the given value) in the artifactStore.default void
createArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)
Creates an artifact rule for a specific Artifact.CompletionStage<Void>
createArtifactRuleAsync(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)
CompletionStage<ArtifactMetaDataDto>
createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData)
Creates a new artifact (from the given value including metadata) in the artifactStore.void
createGlobalRule(RuleType rule, RuleConfigurationDto config)
Creates a single global rule.void
createGroup(GroupMetaDataDto group)
Creates a new empty group and stores it's metadata.List<String>
deleteArtifact(String groupId, String artifactId)
Deletes an artifact by its group and unique id.void
deleteArtifactRule(String groupId, String artifactId, RuleType rule)
Deletes a single stored/configured rule for a given artifact.void
deleteArtifactRules(String groupId, String artifactId)
Deletes all rules stored/configured for the artifact.void
deleteArtifacts(String groupId)
Deletes all artifacts in the given group.void
deleteArtifactVersion(String groupId, String artifactId, String version)
Deletes a single version of a given artifact.void
deleteArtifactVersionMetaData(String groupId, String artifactId, String version)
Deletes the user-editable meta-data for a singel version of a given artifact.void
deleteGlobalRule(RuleType rule)
Deletes a single global rule.void
deleteGlobalRules()
Deletes all of the globally configured rules.void
deleteGroup(String groupId)
Deletes a group intified by the given groupId and DELETES ALL resources related to this groupvoid
exportData(Function<Entity,Void> handler)
Called to export all data in the registry.StoredArtifactDto
getArtifact(String groupId, String artifactId)
Gets the most recent version of the value of the artifact with the given group and ID.ContentHandle
getArtifactByContentHash(String contentHash)
Gets some artifact content by the SHA-256 hash of that content.ContentHandle
getArtifactByContentId(long contentId)
Gets some artifact content by the unique contentId.Set<String>
getArtifactIds(Integer limit)
Get all artifact ids.ArtifactMetaDataDto
getArtifactMetaData(long globalId)
Gets the stored meta-data for an artifact by global ID.ArtifactMetaDataDto
getArtifactMetaData(String groupId, String artifactId)
Gets the stored meta-data for an artifact by group and ID.RuleConfigurationDto
getArtifactRule(String groupId, String artifactId, RuleType rule)
Gets all of the information for a single rule configured on a given artifact.List<RuleType>
getArtifactRules(String groupId, String artifactId)
Gets a list of rules configured for a specific Artifact (by group and ID).StoredArtifactDto
getArtifactVersion(long globalId)
Gets the stored artifact content for the artifact version with the given unique global ID.StoredArtifactDto
getArtifactVersion(String groupId, String artifactId, String version)
Gets the stored value for a single version of a given artifact.ArtifactVersionMetaDataDto
getArtifactVersionMetaData(String groupId, String artifactId, boolean canonical, ContentHandle content)
Gets the metadata of the version that matches content.ArtifactVersionMetaDataDto
getArtifactVersionMetaData(String groupId, String artifactId, String version)
Gets the stored meta-data for a single version of an artifact.List<String>
getArtifactVersions(String groupId, String artifactId)
Gets a sorted set of all artifact versions that exist for a given artifact.List<ArtifactMetaDataDto>
getArtifactVersionsByContentId(long contentId)
Get artifact metadata for a given contentIdRuleConfigurationDto
getGlobalRule(RuleType rule)
Gets all information about a single global rule.List<RuleType>
getGlobalRules()
Gets a list of all global rule names.List<String>
getGroupIds(Integer limit)
Get all groupIdsGroupMetaDataDto
getGroupMetaData(String groupId)
Get the metadata information for a group identified by the given groupIdLogConfigurationDto
getLogConfiguration(String logger)
Returns the log configuration persisted in the storage for the given loggervoid
importData(EntityInputStream entities)
Called to import previously exported data into the registry.default boolean
isAlive()
Is the artifactStore alive?default boolean
isReady()
Is the artifactStore ready?List<LogConfigurationDto>
listLogConfigurations()
Returns the list of log configuration persisted in the storagevoid
removeLogConfiguration(String logger)
Removes the persisted log configuration for the given loggerArtifactSearchResultsDto
searchArtifacts(Set<SearchFilter> filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit)
Search artifacts by given criteriaVersionSearchResultsDto
searchVersions(String groupId, String artifactId, int offset, int limit)
Fetch the versions of the given artifactvoid
setLogConfiguration(LogConfigurationDto logConfiguration)
Persists the given log configurationString
storageName()
The storage nameboolean
supportsMultiTenancy()
Returns true if the storage implementation supports multitenancy.CompletionStage<ArtifactMetaDataDto>
updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content)
Updates the artifact value by storing the given value as a new version of the artifact.void
updateArtifactMetaData(String groupId, String artifactId, EditableArtifactMetaDataDto metaData)
Updates the stored meta-data for an artifact by group and ID.void
updateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)
Updates the configuration information for a single rule on a given artifact.void
updateArtifactState(String groupId, String artifactId, ArtifactState state)
Update artifact state.void
updateArtifactState(String groupId, String artifactId, String version, ArtifactState state)
Update artifact state.void
updateArtifactVersionMetaData(String groupId, String artifactId, String version, EditableArtifactMetaDataDto metaData)
Updates the user-editable meta-data for a single version of a given artifact.CompletionStage<ArtifactMetaDataDto>
updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData)
Updates the artifact value by storing the given value and metadata as a new version of the artifact.void
updateGlobalRule(RuleType rule, RuleConfigurationDto config)
Updates the configuration settings for a single global rule.void
updateGroupMetaData(GroupMetaDataDto group)
Updates the metadata of an existent group.
-
-
-
Method Detail
-
storageName
String storageName()
The storage name
-
supportsMultiTenancy
boolean supportsMultiTenancy()
Returns true if the storage implementation supports multitenancy. If the storage supports multitenancy, it will get the tenant information from theTenantContext
- Returns:
- if multitenancy is supported
-
isReady
default boolean isReady()
Is the artifactStore ready?By default we check if it can access list of global rules.
- Returns:
- true if yes, false if no
-
isAlive
default boolean isAlive()
Is the artifactStore alive?By default it's true.
- Returns:
- true if yes, false if no
-
updateArtifactState
void updateArtifactState(String groupId, String artifactId, ArtifactState state) throws ArtifactNotFoundException, RegistryStorageException
Update artifact state.- Parameters:
groupId
- (optional)artifactId
-state
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
updateArtifactState
void updateArtifactState(String groupId, String artifactId, String version, ArtifactState state) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Update artifact state.- Parameters:
groupId
- (optional)artifactId
-version
-state
-- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
-
createArtifact
CompletionStage<ArtifactMetaDataDto> createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content) throws ArtifactAlreadyExistsException, RegistryStorageException
Creates a new artifact (from the given value) in the artifactStore. The artifactId must be unique within the given artifact group. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value. If the group did not exist previously it is created automatically.- Parameters:
groupId
- (optional)artifactId
-version
- (optional)artifactType
-content
-- Throws:
ArtifactAlreadyExistsException
RegistryStorageException
-
createArtifactWithMetadata
CompletionStage<ArtifactMetaDataDto> createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData) throws ArtifactAlreadyExistsException, RegistryStorageException
Creates a new artifact (from the given value including metadata) in the artifactStore. The artifactId must be unique within the given artifact group. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value.- Parameters:
groupId
- (optional) (optional)artifactId
-version
- (optional)artifactType
-content
-metaData
-- Throws:
ArtifactAlreadyExistsException
RegistryStorageException
-
deleteArtifact
List<String> deleteArtifact(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Deletes an artifact by its group and unique id. Returns list of artifact versions.- Parameters:
groupId
- (optional)artifactId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
deleteArtifacts
void deleteArtifacts(String groupId) throws RegistryStorageException
Deletes all artifacts in the given group. DOES NOT delete the group.- Parameters:
groupId
- (optional)- Throws:
RegistryStorageException
-
getArtifact
StoredArtifactDto getArtifact(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Gets the most recent version of the value of the artifact with the given group and ID.- Parameters:
groupId
- (optional)artifactId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactByContentId
ContentHandle getArtifactByContentId(long contentId) throws ContentNotFoundException, RegistryStorageException
Gets some artifact content by the unique contentId. This method of getting content from storage does not allow extra meta-data to be returned, because the contentId only points to a piece of content/data - it is divorced from any artifact version.- Parameters:
contentId
-- Throws:
ContentNotFoundException
RegistryStorageException
-
getArtifactByContentHash
ContentHandle getArtifactByContentHash(String contentHash) throws ContentNotFoundException, RegistryStorageException
Gets some artifact content by the SHA-256 hash of that content. This method of getting content from storage does not allow extra meta-data to be returned, because the content hash only points to a piece of content/data - it is divorced from any artifact version.- Parameters:
contentHash
-- Throws:
ContentNotFoundException
RegistryStorageException
-
getArtifactVersionsByContentId
List<ArtifactMetaDataDto> getArtifactVersionsByContentId(long contentId)
Get artifact metadata for a given contentId- Parameters:
contentId
-- Returns:
-
updateArtifact
CompletionStage<ArtifactMetaDataDto> updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
Updates the artifact value by storing the given value as a new version of the artifact. Previous value is NOT overwitten. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value.- Parameters:
groupId
- (optional)artifactId
-version
- (optional)artifactType
-content
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
updateArtifactWithMetadata
CompletionStage<ArtifactMetaDataDto> updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, RegistryStorageException
Updates the artifact value by storing the given value and metadata as a new version of the artifact. Previous value is NOT overwitten. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value.- Parameters:
groupId
- (optional)artifactId
-version
- (optional)artifactType
-content
-metaData
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactIds
Set<String> getArtifactIds(Integer limit)
Get all artifact ids. --- Note: This should only be used in older APIs such as the registry V1 REST API and the Confluent API ---- Parameters:
limit
- the limit of artifacts- Returns:
- all artifact ids
-
searchArtifacts
ArtifactSearchResultsDto searchArtifacts(Set<SearchFilter> filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit)
Search artifacts by given criteria- Parameters:
filters
- the set of filters to apply when searchingorderBy
- the field to order byorderDirection
- the direction to order the resultsoffset
- the number of artifacts to skiplimit
- the result size limit
-
getArtifactMetaData
ArtifactMetaDataDto getArtifactMetaData(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Gets the stored meta-data for an artifact by group and ID. This will include client-editable meta-data such as name and description, but also generated meta-data such as "modifedOn" and "globalId".- Parameters:
groupId
- (optional)artifactId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactVersionMetaData
ArtifactVersionMetaDataDto getArtifactVersionMetaData(String groupId, String artifactId, boolean canonical, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
Gets the metadata of the version that matches content.- Parameters:
groupId
- (optional)artifactId
-canonical
-content
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactMetaData
ArtifactMetaDataDto getArtifactMetaData(long globalId) throws ArtifactNotFoundException, RegistryStorageException
Gets the stored meta-data for an artifact by global ID. This will include client-editable meta-data such as name and description, but also generated meta-data such as "modifedOn" and "globalId".- Parameters:
globalId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
updateArtifactMetaData
void updateArtifactMetaData(String groupId, String artifactId, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, RegistryStorageException
Updates the stored meta-data for an artifact by group and ID. Only the client-editable meta-data can be updated. Client editable meta-data includes e.g. name and description. TODO what if set to null?- Parameters:
groupId
- (optional)artifactId
-metaData
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactRules
List<RuleType> getArtifactRules(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Gets a list of rules configured for a specific Artifact (by group and ID). This will return only the names of the rules.- Parameters:
groupId
- (optional)artifactId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
createArtifactRule
default void createArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleAlreadyExistsException, RegistryStorageException
Creates an artifact rule for a specific Artifact. If the named rule already exists for the artifact, then this should fail.- Parameters:
groupId
- (optional)artifactId
-rule
-config
-- Throws:
ArtifactNotFoundException
RuleAlreadyExistsException
RegistryStorageException
-
createArtifactRuleAsync
CompletionStage<Void> createArtifactRuleAsync(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleAlreadyExistsException, RegistryStorageException
-
deleteArtifactRules
void deleteArtifactRules(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Deletes all rules stored/configured for the artifact.- Parameters:
groupId
- (optional)artifactId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactRule
RuleConfigurationDto getArtifactRule(String groupId, String artifactId, RuleType rule) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
Gets all of the information for a single rule configured on a given artifact.- Parameters:
groupId
- (optional)artifactId
-rule
-- Throws:
ArtifactNotFoundException
RuleNotFoundException
RegistryStorageException
-
updateArtifactRule
void updateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
Updates the configuration information for a single rule on a given artifact.- Parameters:
groupId
- (optional)artifactId
-rule
-config
-- Throws:
ArtifactNotFoundException
RuleNotFoundException
RegistryStorageException
-
deleteArtifactRule
void deleteArtifactRule(String groupId, String artifactId, RuleType rule) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
Deletes a single stored/configured rule for a given artifact.- Parameters:
groupId
- (optional)artifactId
-rule
-- Throws:
ArtifactNotFoundException
RuleNotFoundException
RegistryStorageException
-
getArtifactVersions
List<String> getArtifactVersions(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Gets a sorted set of all artifact versions that exist for a given artifact.- Parameters:
groupId
- (optional)artifactId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
searchVersions
VersionSearchResultsDto searchVersions(String groupId, String artifactId, int offset, int limit) throws ArtifactNotFoundException, RegistryStorageException
Fetch the versions of the given artifact- Parameters:
groupId
- (optional)artifactId
- the artifact used to fetch versionslimit
- the result size limitoffset
- the number of versions to skip- Returns:
- the artifact versions, limited
- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactVersion
StoredArtifactDto getArtifactVersion(long globalId) throws ArtifactNotFoundException, RegistryStorageException
Gets the stored artifact content for the artifact version with the given unique global ID.- Parameters:
globalId
-- Throws:
ArtifactNotFoundException
RegistryStorageException
-
getArtifactVersion
StoredArtifactDto getArtifactVersion(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Gets the stored value for a single version of a given artifact.- Parameters:
groupId
- (optional)artifactId
-version
-- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
-
deleteArtifactVersion
void deleteArtifactVersion(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Deletes a single version of a given artifact.- Parameters:
groupId
- (optional)artifactId
-version
-- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
-
getArtifactVersionMetaData
ArtifactVersionMetaDataDto getArtifactVersionMetaData(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Gets the stored meta-data for a single version of an artifact. This will return all meta-data for the version, including any user edited meta-data along with anything generated by the artifactStore.- Parameters:
groupId
- (optional)artifactId
-version
-- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
-
updateArtifactVersionMetaData
void updateArtifactVersionMetaData(String groupId, String artifactId, String version, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Updates the user-editable meta-data for a single version of a given artifact. Only the client-editable meta-data can be updated. Client editable meta-data includes e.g. name and description.- Parameters:
groupId
- (optional)artifactId
-version
-metaData
-- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
-
deleteArtifactVersionMetaData
void deleteArtifactVersionMetaData(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Deletes the user-editable meta-data for a singel version of a given artifact. Only the client-editable meta-data is deleted. Any meta-data generated by the artifactStore is preserved.- Parameters:
groupId
- (optional)artifactId
-version
-- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
-
getGlobalRules
List<RuleType> getGlobalRules() throws RegistryStorageException
Gets a list of all global rule names.- Throws:
RegistryStorageException
-
createGlobalRule
void createGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleAlreadyExistsException, RegistryStorageException
Creates a single global rule. Duplicates (by name) are not allowed. Stores the rule name and configuration.- Parameters:
rule
-config
-- Throws:
RuleAlreadyExistsException
RegistryStorageException
-
deleteGlobalRules
void deleteGlobalRules() throws RegistryStorageException
Deletes all of the globally configured rules.- Throws:
RegistryStorageException
-
getGlobalRule
RuleConfigurationDto getGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
Gets all information about a single global rule.- Parameters:
rule
-- Throws:
RuleNotFoundException
RegistryStorageException
-
updateGlobalRule
void updateGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleNotFoundException, RegistryStorageException
Updates the configuration settings for a single global rule.- Parameters:
rule
-config
-- Throws:
RuleNotFoundException
RegistryStorageException
-
deleteGlobalRule
void deleteGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
Deletes a single global rule.- Parameters:
rule
-- Throws:
RuleNotFoundException
RegistryStorageException
-
getLogConfiguration
LogConfigurationDto getLogConfiguration(String logger) throws RegistryStorageException, LogConfigurationNotFoundException
Returns the log configuration persisted in the storage for the given logger- Parameters:
logger
-- Throws:
RegistryStorageException
LogConfigurationNotFoundException
-
setLogConfiguration
void setLogConfiguration(LogConfigurationDto logConfiguration) throws RegistryStorageException
Persists the given log configuration- Parameters:
logConfiguration
-- Throws:
RegistryStorageException
-
removeLogConfiguration
void removeLogConfiguration(String logger) throws RegistryStorageException, LogConfigurationNotFoundException
Removes the persisted log configuration for the given logger- Parameters:
logger
-- Throws:
RegistryStorageException
LogConfigurationNotFoundException
-
listLogConfigurations
List<LogConfigurationDto> listLogConfigurations() throws RegistryStorageException
Returns the list of log configuration persisted in the storage- Throws:
RegistryStorageException
-
createGroup
void createGroup(GroupMetaDataDto group) throws GroupAlreadyExistsException, RegistryStorageException
Creates a new empty group and stores it's metadata. When creating an artifact the group is automatically created in it does not exist.- Parameters:
group
-- Throws:
GroupAlreadyExistsException
RegistryStorageException
-
updateGroupMetaData
void updateGroupMetaData(GroupMetaDataDto group) throws GroupNotFoundException, RegistryStorageException
Updates the metadata of an existent group.- Parameters:
group
-- Throws:
RegistryStorageException
GroupNotFoundException
-
deleteGroup
void deleteGroup(String groupId) throws GroupNotFoundException, RegistryStorageException
Deletes a group intified by the given groupId and DELETES ALL resources related to this group- Parameters:
groupId
- (optional)- Throws:
GroupNotFoundException
RegistryStorageException
-
getGroupIds
List<String> getGroupIds(Integer limit) throws RegistryStorageException
Get all groupIds- Parameters:
limit
-- Throws:
RegistryStorageException
-
getGroupMetaData
GroupMetaDataDto getGroupMetaData(String groupId) throws GroupNotFoundException, RegistryStorageException
Get the metadata information for a group identified by the given groupId- Parameters:
groupId
- (optional)- Throws:
GroupNotFoundException
RegistryStorageException
-
exportData
void exportData(Function<Entity,Void> handler) throws RegistryStorageException
Called to export all data in the registry. Caller provides a handle to handle the data/entities. This should be used to stream the data from the storage to some output source (e.g. a HTTP response). It is important that the full dataset is *not* kept in memory.- Parameters:
handler
-- Throws:
RegistryStorageException
-
importData
void importData(EntityInputStream entities) throws RegistryStorageException
Called to import previously exported data into the registry.- Parameters:
entities
-- Throws:
RegistryStorageException
-
-