Documentation ¶
Index ¶
- type CachedClient
- func (client *CachedClient) CreateSubject(subject string, codec *goavro.Codec) (int, error)
- func (client *CachedClient) DeleteSubject(subject string) error
- func (client *CachedClient) DeleteVersion(subject string, version int) error
- func (client *CachedClient) GetLatestSchema(subject string) (*goavro.Codec, error)
- func (client *CachedClient) GetSchema(id int) (*goavro.Codec, error)
- func (client *CachedClient) GetSchemaByVersion(subject string, version int) (*goavro.Codec, error)
- func (client *CachedClient) GetSubjects() ([]string, error)
- func (client *CachedClient) GetVersions(subject string) ([]int, error)
- func (client *CachedClient) IsSchemaRegistered(subject string, codec *goavro.Codec) (int, error)
- type Client
- type Error
- type HTTPClient
- func (client *HTTPClient) CreateSubject(subject string, codec *goavro.Codec) (int, error)
- func (client *HTTPClient) DeleteSubject(subject string) error
- func (client *HTTPClient) DeleteVersion(subject string, version int) error
- func (client *HTTPClient) GetLatestSchema(subject string) (*goavro.Codec, error)
- func (client *HTTPClient) GetSchema(id int) (*goavro.Codec, error)
- func (client *HTTPClient) GetSchemaByVersion(subject string, version int) (*goavro.Codec, error)
- func (client *HTTPClient) GetSubjects() ([]string, error)
- func (client *HTTPClient) GetVersions(subject string) ([]int, error)
- func (client *HTTPClient) IsSchemaRegistered(subject string, codec *goavro.Codec) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedClient ¶
type CachedClient struct {
// contains filtered or unexported fields
}
CachedClient is a schema registry client that will cache calls to GetSchema to improve performance
func NewCachedClient ¶
func NewCachedClient(connect []string) *CachedClient
NewCachedClient creates a cached client that will round robin requests to the servers specified
By default it will retry failed requests (5XX responses and http errors) len(connect) number of times
func NewCachedClientWithRetries ¶
func NewCachedClientWithRetries(connect []string, retries int) *CachedClient
NewCachedClientWithRetries creates a cached client that will round robin requests to the servers specified and will retry failed requests (5XX responses and http errors) retries number of times
func (*CachedClient) CreateSubject ¶
CreateSubject creates a new schema under the specified subject Will always make an http call
func (*CachedClient) DeleteSubject ¶
func (client *CachedClient) DeleteSubject(subject string) error
DeleteSubject deletes the subject, should only be used in development Will always make an http call
func (*CachedClient) DeleteVersion ¶
func (client *CachedClient) DeleteVersion(subject string, version int) error
DeleteVersion deletes the a specific version of a subject, should only be used in development. Will always make an http call
func (*CachedClient) GetLatestSchema ¶
func (client *CachedClient) GetLatestSchema(subject string) (*goavro.Codec, error)
GetLatestSchema returns the highest version schema for a subject Will always make an http call
func (*CachedClient) GetSchema ¶
func (client *CachedClient) GetSchema(id int) (*goavro.Codec, error)
GetSchema will return and cache the codec with the given id
func (*CachedClient) GetSchemaByVersion ¶
GetSchemaByVersion returns the codec for a specific version of a subject
func (*CachedClient) GetSubjects ¶
func (client *CachedClient) GetSubjects() ([]string, error)
GetSubjects returns a list of subjects Will always make an http call
func (*CachedClient) GetVersions ¶
func (client *CachedClient) GetVersions(subject string) ([]int, error)
GetVersions returns a list of all versions of a subject. Will always make an http call Will always make an http call
func (*CachedClient) IsSchemaRegistered ¶
IsSchemaRegistered checks if a specific codec is already registered to a subject Will always make an http call
type Client ¶
type Client interface { GetSchema(int) (*goavro.Codec, error) GetSubjects() ([]string, error) GetVersions(string) ([]int, error) GetSchemaByVersion(string, int) (*goavro.Codec, error) GetLatestSchema(string) (*goavro.Codec, error) CreateSubject(string, *goavro.Codec) (int, error) IsSchemaRegistered(string, *goavro.Codec) (int, error) DeleteSubject(string) error DeleteVersion(string, int) error }
Client defines the api for all clients interfacing with schema registry
type HTTPClient ¶
type HTTPClient struct { SchemaRegistryConnect []string // contains filtered or unexported fields }
HTTPClient is a basic http client to interact with schema registry
func NewHTTPClient ¶
func NewHTTPClient(connect []string) *HTTPClient
NewHTTPClient creates a client to talk with the schema registry at the connect string
By default it will retry failed requests (5XX responses and http errors) len(connect) number of times
func NewHTTPClientWithRetries ¶
func NewHTTPClientWithRetries(connect []string, retries int) *HTTPClient
NewHTTPClientWithRetries creates an http client with a configurable amount of retries on 5XX responses
func (*HTTPClient) CreateSubject ¶
CreateSubject adds a schema to the subject
func (*HTTPClient) DeleteSubject ¶
func (client *HTTPClient) DeleteSubject(subject string) error
DeleteSubject deletes a subject. It should only be used in development
func (*HTTPClient) DeleteVersion ¶
func (client *HTTPClient) DeleteVersion(subject string, version int) error
DeleteVersion deletes a subject. It should only be used in development
func (*HTTPClient) GetLatestSchema ¶
func (client *HTTPClient) GetLatestSchema(subject string) (*goavro.Codec, error)
GetLatestSchema returns a goavro.Codec for the latest version of the subject
func (*HTTPClient) GetSchema ¶
func (client *HTTPClient) GetSchema(id int) (*goavro.Codec, error)
GetSchema returns a goavro.Codec by unique id
func (*HTTPClient) GetSchemaByVersion ¶
GetSchemaByVersion returns a goavro.Codec for the version of the subject
func (*HTTPClient) GetSubjects ¶
func (client *HTTPClient) GetSubjects() ([]string, error)
GetSubjects returns a list of all subjects in the schema registry
func (*HTTPClient) GetVersions ¶
func (client *HTTPClient) GetVersions(subject string) ([]int, error)
GetVersions returns a list of the versions of a subject
func (*HTTPClient) IsSchemaRegistered ¶
IsSchemaRegistered tests if the schema is registered, if so it returns the unique id of that schema