Documentation ¶
Index ¶
- type ISchemaRegistryClient
- type Ids
- type MockSchemaRegistryClient
- func (mck MockSchemaRegistryClient) CachingEnabled(value bool)
- func (mck MockSchemaRegistryClient) CodecCreationEnabled(value bool)
- func (mck MockSchemaRegistryClient) CreateSchema(subject string, schema string, schemaType SchemaType, isKey bool, ...) (*Schema, error)
- func (mck MockSchemaRegistryClient) DeleteSubject(subject string, _ bool) error
- func (mck MockSchemaRegistryClient) GetLatestSchema(subject string, isKey bool) (*Schema, error)
- func (mck MockSchemaRegistryClient) GetSchema(schemaID int) (*Schema, error)
- func (mck MockSchemaRegistryClient) GetSchemaByVersion(subject string, version int, isKey bool) (*Schema, error)
- func (mck MockSchemaRegistryClient) GetSchemaVersions(subject string, isKey bool) ([]int, error)
- func (mck MockSchemaRegistryClient) GetSubjects() ([]string, error)
- func (mck MockSchemaRegistryClient) IsSchemaCompatible(subject, schema, version string, schemaType SchemaType, isKey bool) (bool, error)
- func (mck MockSchemaRegistryClient) SetCredentials(username string, password string)
- func (mck MockSchemaRegistryClient) SetTimeout(timeout time.Duration)
- func (mck MockSchemaRegistryClient) SetTransport(transportt *http.Transport)
- type Reference
- type Schema
- type SchemaRegistryClient
- func (client *SchemaRegistryClient) CachingEnabled(value bool)
- func (client *SchemaRegistryClient) CodecCreationEnabled(value bool)
- func (client *SchemaRegistryClient) CreateSchema(subject string, schema string, schemaType SchemaType, isKey bool, ...) (*Schema, error)
- func (client *SchemaRegistryClient) DeleteSubject(subject string, permanent bool) error
- func (client *SchemaRegistryClient) GetLatestSchema(subject string, isKey bool) (*Schema, error)
- func (client *SchemaRegistryClient) GetSchema(schemaID int) (*Schema, error)
- func (client *SchemaRegistryClient) GetSchemaByVersion(subject string, version int, isKey bool) (*Schema, error)
- func (client *SchemaRegistryClient) GetSchemaVersions(subject string, isKey bool) ([]int, error)
- func (client *SchemaRegistryClient) GetSubjects() ([]string, error)
- func (client *SchemaRegistryClient) IsSchemaCompatible(subject, schema, version string, schemaType SchemaType, isKey bool) (bool, error)
- func (client *SchemaRegistryClient) SetCredentials(username string, password string)
- func (client *SchemaRegistryClient) SetTimeout(timeout time.Duration)
- func (client *SchemaRegistryClient) SetTransport(transport *http.Transport)
- type SchemaType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ISchemaRegistryClient ¶
type ISchemaRegistryClient interface { GetSubjects() ([]string, error) GetSchema(schemaID int) (*Schema, error) GetLatestSchema(subject string, isKey bool) (*Schema, error) GetSchemaVersions(subject string, isKey bool) ([]int, error) GetSchemaByVersion(subject string, version int, isKey bool) (*Schema, error) CreateSchema(subject string, schema string, schemaType SchemaType, isKey bool, references ...Reference) (*Schema, error) DeleteSubject(subject string, permanent bool) error SetCredentials(username string, password string) SetTimeout(timeout time.Duration) SetTransport(transport *http.Transport) CachingEnabled(value bool) CodecCreationEnabled(value bool) IsSchemaCompatible(subject, schema, version string, schemaType SchemaType, isKey bool) (bool, error) }
ISchemaRegistryClient provides the definition of the operations that this Schema Registry client provides.
type MockSchemaRegistryClient ¶
type MockSchemaRegistryClient struct {
// contains filtered or unexported fields
}
func CreateMockSchemaRegistryClient ¶
func CreateMockSchemaRegistryClient(mockURL string) MockSchemaRegistryClient
Constructor
func (MockSchemaRegistryClient) CachingEnabled ¶
func (mck MockSchemaRegistryClient) CachingEnabled(value bool)
func (MockSchemaRegistryClient) CodecCreationEnabled ¶
func (mck MockSchemaRegistryClient) CodecCreationEnabled(value bool)
func (MockSchemaRegistryClient) CreateSchema ¶
func (mck MockSchemaRegistryClient) CreateSchema(subject string, schema string, schemaType SchemaType, isKey bool, references ...Reference) (*Schema, error)
Mock Schema creation and registration. CreateSchema behaves in two possible ways according to the scenario: 1. The schema being registered is for an already existing `concrete subject`. In that case, we increase our schemaID counter and register the schema under that subject in memory. 2. The schema being registered is for a previously unknown `concrete subject`. In that case, we set this schema as the first version of the subject and store it in memory.
Note that there is no enforcement of schema compatibility, any schema goes for all subjects.
func (MockSchemaRegistryClient) DeleteSubject ¶
func (mck MockSchemaRegistryClient) DeleteSubject(subject string, _ bool) error
DeleteSubject removes given subject from cache
func (MockSchemaRegistryClient) GetLatestSchema ¶
func (mck MockSchemaRegistryClient) GetLatestSchema(subject string, isKey bool) (*Schema, error)
Returns the highest ordinal version of a Schema for a given `concrete subject`
func (MockSchemaRegistryClient) GetSchema ¶
func (mck MockSchemaRegistryClient) GetSchema(schemaID int) (*Schema, error)
Returns a Schema for the given ID
func (MockSchemaRegistryClient) GetSchemaByVersion ¶
func (mck MockSchemaRegistryClient) GetSchemaByVersion(subject string, version int, isKey bool) (*Schema, error)
Returns the given Schema according to the passed in subject and version number
func (MockSchemaRegistryClient) GetSchemaVersions ¶
func (mck MockSchemaRegistryClient) GetSchemaVersions(subject string, isKey bool) ([]int, error)
Returns the array of versions this subject has previously registered
func (MockSchemaRegistryClient) GetSubjects ¶
func (mck MockSchemaRegistryClient) GetSubjects() ([]string, error)
Returns all registered subjects
func (MockSchemaRegistryClient) IsSchemaCompatible ¶
func (mck MockSchemaRegistryClient) IsSchemaCompatible(subject, schema, version string, schemaType SchemaType, isKey bool) (bool, error)
func (MockSchemaRegistryClient) SetCredentials ¶
func (mck MockSchemaRegistryClient) SetCredentials(username string, password string)
The classes below are implemented to accommodate ISchemaRegistryClient; However, they do nothing.
func (MockSchemaRegistryClient) SetTimeout ¶
func (mck MockSchemaRegistryClient) SetTimeout(timeout time.Duration)
func (MockSchemaRegistryClient) SetTransport ¶
func (mck MockSchemaRegistryClient) SetTransport(transportt *http.Transport)
type Reference ¶
type Reference struct { Name string `json:"name"` Subject string `json:"subject"` Version int `json:"version"` }
Schema references use the import statement of Protobuf and the $ref field of JSON Schema. They are defined by the name of the import or $ref and the associated subject in the registry.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is a data structure that holds all the relevant information about schemas.
type SchemaRegistryClient ¶
type SchemaRegistryClient struct {
// contains filtered or unexported fields
}
SchemaRegistryClient allows interactions with Schema Registry over HTTP. Applications using this client can retrieve data about schemas, which in turn can be used to serialize and deserialize data.
func CreateSchemaRegistryClient ¶
func CreateSchemaRegistryClient(schemaRegistryURL string) *SchemaRegistryClient
CreateSchemaRegistryClient creates a client that allows interactions with Schema Registry over HTTP. Applications using this client can retrieve data about schemas, which in turn can be used to serialize and deserialize records.
func (*SchemaRegistryClient) CachingEnabled ¶
func (client *SchemaRegistryClient) CachingEnabled(value bool)
CachingEnabled allows the client to cache any values that have been returned, which may speed up performance if these values rarely changes.
func (*SchemaRegistryClient) CodecCreationEnabled ¶
func (client *SchemaRegistryClient) CodecCreationEnabled(value bool)
CodecCreationEnabled allows the application to enable/disable the automatic creation of codec's when schemas are returned.
func (*SchemaRegistryClient) CreateSchema ¶
func (client *SchemaRegistryClient) CreateSchema(subject string, schema string, schemaType SchemaType, isKey bool, references ...Reference) (*Schema, error)
CreateSchema creates a new schema in Schema Registry and associates with the subject provided. It returns the newly created schema with all its associated information.
func (*SchemaRegistryClient) DeleteSubject ¶
func (client *SchemaRegistryClient) DeleteSubject(subject string, permanent bool) error
DeleteSubject deletes
func (*SchemaRegistryClient) GetLatestSchema ¶
func (client *SchemaRegistryClient) GetLatestSchema(subject string, isKey bool) (*Schema, error)
GetLatestSchema gets the schema associated with the given subject. The schema returned contains the last version for that subject.
func (*SchemaRegistryClient) GetSchema ¶
func (client *SchemaRegistryClient) GetSchema(schemaID int) (*Schema, error)
GetSchema gets the schema associated with the given id.
func (*SchemaRegistryClient) GetSchemaByVersion ¶
func (client *SchemaRegistryClient) GetSchemaByVersion(subject string, version int, isKey bool) (*Schema, error)
GetSchemaByVersion gets the schema associated with the given subject. The schema returned contains the version specified as a parameter.
func (*SchemaRegistryClient) GetSchemaVersions ¶
func (client *SchemaRegistryClient) GetSchemaVersions(subject string, isKey bool) ([]int, error)
GetSchemaVersions returns a list of versions from a given subject.
func (*SchemaRegistryClient) GetSubjects ¶
func (client *SchemaRegistryClient) GetSubjects() ([]string, error)
GetSubjects returns a list of all subjects in the registry
func (*SchemaRegistryClient) IsSchemaCompatible ¶
func (client *SchemaRegistryClient) IsSchemaCompatible(subject, schema, version string, schemaType SchemaType, isKey bool) (bool, error)
IsSchemaCompatible checks if the given schema is compatible with the given subject and version valid versions are versionID and "latest"
func (*SchemaRegistryClient) SetCredentials ¶
func (client *SchemaRegistryClient) SetCredentials(username string, password string)
SetCredentials allows users to set credentials to be used with Schema Registry, for scenarios when Schema Registry has authentication enabled.
func (*SchemaRegistryClient) SetTimeout ¶
func (client *SchemaRegistryClient) SetTimeout(timeout time.Duration)
SetTimeout allows the client to be reconfigured about how much time internal HTTP requests will take until they timeout. FYI, It defaults to five seconds.
func (*SchemaRegistryClient) SetTransport ¶
func (client *SchemaRegistryClient) SetTransport(transport *http.Transport)
SetTransport allows the client to be reconfigured with a httpClient transport to get mutually authenticated TLS working
type SchemaType ¶
type SchemaType string
const ( Protobuf SchemaType = "PROTOBUF" Avro SchemaType = "AVRO" Json SchemaType = "JSON" )
func (SchemaType) String ¶
func (s SchemaType) String() string