Class NativeMetadataRepository

    • Field Detail


        protected static final int THIN_CLIENT_RETRY_COUNT
        See Also:
        Constant Field Values

        protected static final long THIN_CLIENT_RETRY_BACKOFF_MS
        See Also:
        Constant Field Values
      • subscribedStoreMap

        protected final java.util.Map<java.lang.String,​Store> subscribedStoreMap
    • Method Detail

      • start

        public void start()
      • getStore

        public Store getStore​(java.lang.String storeName)
        Description copied from interface: ReadOnlyStoreRepository
        Get one store by given name from repository.
        Specified by:
        getStore in interface ReadOnlyStoreRepository
        storeName - name of wanted store.
        Store for given name.
      • refreshOneStore

        public Store refreshOneStore​(java.lang.String storeName)
        Description copied from interface: ReadOnlyStoreRepository
        Selective refresh operation which fetches one store from ZK
        Specified by:
        refreshOneStore in interface ReadOnlyStoreRepository
        storeName - store name
        the newly refreshed store
      • getKeySchema

        public SchemaEntry getKeySchema​(java.lang.String storeName)
        This function is used to retrieve key schema for the given store. If key schema for the given store doesn't exist, will return null; Otherwise, it will return the key schema;
        Specified by:
        getKeySchema in interface ReadOnlySchemaRepository
        null, if key schema for the given store doesn't exist; key schema entry, otherwise;
      • getValueSchema

        public SchemaEntry getValueSchema​(java.lang.String storeName,
                                          int id)
        This function is used to retrieve the value schema for the given store and value schema id. Caller shouldn't modify the returned SchemeEntry
        Specified by:
        getValueSchema in interface ReadOnlySchemaRepository
        null, if the schema doesn't exist; value schema entry, otherwise;
      • hasValueSchema

        public boolean hasValueSchema​(java.lang.String storeName,
                                      int id)
        This function is used to check whether the value schema id is valid in the given store.
        Specified by:
        hasValueSchema in interface ReadOnlySchemaRepository
      • getValueSchemaId

        public int getValueSchemaId​(java.lang.String storeName,
                                    java.lang.String valueSchemaStr)
        This function is used to retrieve value schema id for the given store and schema.
        Specified by:
        getValueSchemaId in interface ReadOnlySchemaRepository
        SchemaData.INVALID_VALUE_SCHEMA_ID, if the schema doesn't exist in the given store; schema id (int), if the schema exists in the given store
      • getValueSchemas

        public java.util.Collection<SchemaEntry> getValueSchemas​(java.lang.String storeName)
        This function is used to retrieve all the value schemas for the given store.
        Specified by:
        getValueSchemas in interface ReadOnlySchemaRepository
      • getSupersetSchema

        public SchemaEntry getSupersetSchema​(java.lang.String storeName)
        Description copied from interface: ReadOnlySchemaRepository
        Get the superset value schema for a given store. Each store has at most one active superset schema. Specifically a store must have some features enabled (e.g. read compute, write compute) to have a superset value schema which evolves as new value schemas are added.
        Specified by:
        getSupersetSchema in interface ReadOnlySchemaRepository
        Superset value schema or null if store {@param storeName} does not have any superset value schema.
      • getDerivedSchemaId

        public GeneratedSchemaID getDerivedSchemaId​(java.lang.String storeName,
                                                    java.lang.String derivedSchemaStr)
        Description copied from interface: ReadOnlySchemaRepository
        Look up derived schema id and its corresponding value schema id by given store name and derived schema. This is likely used by clients that write to Venice
        Specified by:
        getDerivedSchemaId in interface ReadOnlySchemaRepository
        a pair where the first value is value schema id and the second value is derived schema id
      • refresh

        public void refresh()
        This method will be triggered periodically to keep the store/schema information up-to-date.
        Specified by:
        refresh in interface VeniceResource
      • clear

        public void clear()
        TODO: we may need to rename this function to be 'close' since this resource should not used any more after calling this function.
        Specified by:
        clear in interface VeniceResource
      • getAndSetStoreConfigFromSystemStore

        protected void getAndSetStoreConfigFromSystemStore​(java.lang.String storeName)
        Get the store cluster config from system store and update the local cache with it. Different implementation will get the data differently but should all populate the store cluster config map.
      • getStoreConfigFromSystemStore

        protected abstract StoreConfig getStoreConfigFromSystemStore​(java.lang.String storeName)
      • getStoreFromSystemStore

        protected abstract Store getStoreFromSystemStore​(java.lang.String storeName,
                                                         java.lang.String clusterName)
      • getStoreConfigFromMetaSystemStore

        protected StoreConfig getStoreConfigFromMetaSystemStore​(java.lang.String storeName)
      • getSchemaDataFromMetaSystemStore

        protected SchemaData getSchemaDataFromMetaSystemStore​(java.lang.String storeName)
      • putStore

        protected Store putStore​(Store newStore)
      • removeStore

        protected Store removeStore​(java.lang.String storeName)
      • notifyStoreCreated

        protected void notifyStoreCreated​(Store store)
      • notifyStoreDeleted

        protected void notifyStoreDeleted​(Store store)
      • notifyStoreChanged

        protected void notifyStoreChanged​(Store store)
      • getAndCacheSchemaDataFromSystemStore

        protected SchemaData getAndCacheSchemaDataFromSystemStore​(java.lang.String storeName)
      • getValueSchemaInternally

        protected SchemaEntry getValueSchemaInternally​(java.lang.String storeName,
                                                       int id)
      • getSchemaDataFromSystemStore

        protected abstract SchemaData getSchemaDataFromSystemStore​(java.lang.String storeName)
      • removeStoreSchema

        protected void removeStoreSchema​(java.lang.String storeName)
        This function is used to remove schema entry for the given store from local cache, and related listeners as well.
      • getVeniceCluster

        public java.lang.String getVeniceCluster​(java.lang.String storeName)
        Description copied from interface: ClusterInfoProvider
        Get the associated Venice cluster name given a Venice store name.
        Specified by:
        getVeniceCluster in interface ClusterInfoProvider
        the cluster name that the store belongs to or null if such information cannot be provided.