Search in sources :

Example 1 with SchemaBranchCache

use of com.hortonworks.registries.schemaregistry.cache.SchemaBranchCache in project registry by hortonworks.

the class DefaultSchemaRegistry method init.

@Override
public void init(Map<String, Object> props) {
    storageManager.registerStorables(Arrays.asList(SchemaMetadataStorable.class, SchemaVersionStorable.class, SchemaVersionStateStorable.class, SchemaFieldInfoStorable.class, SerDesInfoStorable.class, SchemaSerDesMapping.class, SchemaBranchStorable.class, SchemaBranchVersionMapping.class, HostConfigStorable.class));
    Options options = new Options(props);
    schemaBranchCache = new SchemaBranchCache(options.getMaxSchemaCacheSize(), options.getSchemaExpiryInSecs(), createSchemaBranchFetcher());
    SchemaMetadataFetcher schemaMetadataFetcher = createSchemaMetadataFetcher();
    schemaVersionLifecycleManager = new SchemaVersionLifecycleManager(storageManager, props, schemaMetadataFetcher, schemaBranchCache, haServerNotificationManager);
    Collection<? extends SchemaProvider> schemaProviders = initSchemaProviders(schemaProvidersConfig, schemaVersionLifecycleManager.getSchemaVersionRetriever());
    this.schemaTypeWithProviders = schemaProviders.stream().collect(Collectors.toMap(SchemaProvider::getType, Function.identity()));
    schemaProviderInfos = Collections.unmodifiableList(schemaProviders.stream().map(schemaProvider -> new SchemaProviderInfo(schemaProvider.getType(), schemaProvider.getName(), schemaProvider.getDescription(), schemaProvider.getDefaultSerializerClassName(), schemaProvider.getDefaultDeserializerClassName())).collect(Collectors.toList()));
}
Also used : ObjectMapperUtils(com.hortonworks.registries.schemaregistry.utils.ObjectMapperUtils) SchemaBranchCache(com.hortonworks.registries.schemaregistry.cache.SchemaBranchCache) SchemaVersionLifecycleStateMachineInfo(com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleStateMachineInfo) Arrays(java.util.Arrays) SchemaBranchNotFoundException(com.hortonworks.registries.schemaregistry.errors.SchemaBranchNotFoundException) UnsupportedSchemaTypeException(com.hortonworks.registries.schemaregistry.errors.UnsupportedSchemaTypeException) InitializedStateDetails(com.hortonworks.registries.schemaregistry.state.details.InitializedStateDetails) SchemaVersionLifecycleStates(com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleStates) QueryParam(com.hortonworks.registries.common.QueryParam) FileStorage(com.hortonworks.registries.common.util.FileStorage) LoggerFactory(org.slf4j.LoggerFactory) Storable(com.hortonworks.registries.storage.Storable) OrderByField(com.hortonworks.registries.storage.OrderByField) HashMap(java.util.HashMap) Function(java.util.function.Function) ArrayList(java.util.ArrayList) SchemaRegistryCacheType(com.hortonworks.registries.schemaregistry.cache.SchemaRegistryCacheType) Map(java.util.Map) OrderBy(com.hortonworks.registries.storage.search.OrderBy) WhereClause(com.hortonworks.registries.storage.search.WhereClause) IncompatibleSchemaException(com.hortonworks.registries.schemaregistry.errors.IncompatibleSchemaException) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) InvalidSchemaException(com.hortonworks.registries.schemaregistry.errors.InvalidSchemaException) Collection(java.util.Collection) InvalidSchemaBranchDeletionException(com.hortonworks.registries.schemaregistry.errors.InvalidSchemaBranchDeletionException) SchemaLifecycleException(com.hortonworks.registries.schemaregistry.state.SchemaLifecycleException) IOException(java.io.IOException) UUID(java.util.UUID) SchemaVersionLifecycleContext(com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleContext) Collectors(java.util.stream.Collectors) MergeInfo(com.hortonworks.registries.schemaregistry.state.details.MergeInfo) SerDesException(com.hortonworks.registries.schemaregistry.serde.SerDesException) SearchQuery(com.hortonworks.registries.storage.search.SearchQuery) List(java.util.List) SchemaVersionInfoCache(com.hortonworks.registries.schemaregistry.cache.SchemaVersionInfoCache) SchemaNotFoundException(com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException) Preconditions(com.google.common.base.Preconditions) SchemaBranchAlreadyExistsException(com.hortonworks.registries.schemaregistry.errors.SchemaBranchAlreadyExistsException) StorableKey(com.hortonworks.registries.storage.StorableKey) StorageManager(com.hortonworks.registries.storage.StorageManager) Collections(java.util.Collections) InputStream(java.io.InputStream) SchemaBranchCache(com.hortonworks.registries.schemaregistry.cache.SchemaBranchCache)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 QueryParam (com.hortonworks.registries.common.QueryParam)1 FileStorage (com.hortonworks.registries.common.util.FileStorage)1 SchemaBranchCache (com.hortonworks.registries.schemaregistry.cache.SchemaBranchCache)1 SchemaRegistryCacheType (com.hortonworks.registries.schemaregistry.cache.SchemaRegistryCacheType)1 SchemaVersionInfoCache (com.hortonworks.registries.schemaregistry.cache.SchemaVersionInfoCache)1 IncompatibleSchemaException (com.hortonworks.registries.schemaregistry.errors.IncompatibleSchemaException)1 InvalidSchemaBranchDeletionException (com.hortonworks.registries.schemaregistry.errors.InvalidSchemaBranchDeletionException)1 InvalidSchemaException (com.hortonworks.registries.schemaregistry.errors.InvalidSchemaException)1 SchemaBranchAlreadyExistsException (com.hortonworks.registries.schemaregistry.errors.SchemaBranchAlreadyExistsException)1 SchemaBranchNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaBranchNotFoundException)1 SchemaNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException)1 UnsupportedSchemaTypeException (com.hortonworks.registries.schemaregistry.errors.UnsupportedSchemaTypeException)1 SerDesException (com.hortonworks.registries.schemaregistry.serde.SerDesException)1 SchemaLifecycleException (com.hortonworks.registries.schemaregistry.state.SchemaLifecycleException)1 SchemaVersionLifecycleContext (com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleContext)1 SchemaVersionLifecycleStateMachineInfo (com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleStateMachineInfo)1 SchemaVersionLifecycleStates (com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleStates)1 InitializedStateDetails (com.hortonworks.registries.schemaregistry.state.details.InitializedStateDetails)1 MergeInfo (com.hortonworks.registries.schemaregistry.state.details.MergeInfo)1