Interface IdGenerator

All Known Implementing Classes:
IncrementalIdGenerator

public interface IdGenerator
Internal interface used for generating id while registering schema.
  • Method Details

    • id

      int id(SchemaValue schema) throws IdGenerationException
      Provides the id for the schema.
      Parameters:
      schema - the schema being registered; never null
      Returns:
      the identifier for the schema; never null
      Throws:
      IdGenerationException - exception when id can't be generated
    • configure

      void configure(SchemaRegistryConfig config)
      Configure the underlying generator.
      Parameters:
      config - Schema Registry Configs
    • init

      void init() throws IdGenerationException
      Initialize the underlying generator.
      Throws:
      IdGenerationException - exception when IdGenerator can't be initialized
    • getMaxId

      int getMaxId(SchemaValue schema)
      Returns the current max id from the generator
      Parameters:
      schema - current schema in the request to Schema Registry
      Returns:
      the max id; never null
    • schemaRegistered

      void schemaRegistered(SchemaKey schemaKey, SchemaValue schemaValue)
      Callback method that is invoked when a schema is registered. IdGenerator implementation can optionally use this to update the next possible id.
      Parameters:
      schemaKey - the registered SchemaKey; never null
      schemaValue - the registered SchemaValue; never null