Documentation ¶
Overview ¶
Package blog contains interfaces to Akutan's data log.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Factories = make(map[string]Factory)
Factories is a registry of named AkutanLog constructors.
Functions ¶
func IsClosedError ¶
IsClosedError returns true if err has type ClosedError, false otherwise.
func IsTruncatedError ¶
IsTruncatedError returns true if err has type TruncatedError, false otherwise.
Types ¶
type AkutanLog ¶
type AkutanLog interface { // Append adds entries to the log. The data items might end up out of order in // the log and at non-consecutive indexes. If all the entries are appended // successfully, returns the corresponding indexes (in a slice the same length // as 'data') and nil. Otherwise, returns either a context error or a // ClosedError. Append(ctx context.Context, data [][]byte) ([]Index, error) // AppendSingle adds only a single entry to the log. If the entry is appended // successfully, returns its index and nil. Otherwise, returns either a context // error or a ClosedError. AppendSingle(ctx context.Context, data []byte) (Index, error) // Discard truncates the prefix of the log. After this is invoked, every entry // up to and excluding firstIndex is subject to deletion. If the server commits // to discarding the prefix, returns nil. Otherwise, returns either a context // error or a ClosedError. Discard(ctx context.Context, firstIndex Index) error // Read gets a suffix of the log and follows/tails the end of the log. nextIndex // is the index of the first entry to send on entriesCh. Read continues until it // encounters an error. Then it closes entriesCh and returns either a context // error, a TruncatedError, or a ClosedError. Read(ctx context.Context, nextIndex Index, entriesCh chan<- []Entry) error // Info fetches log metadata. Upon success, it returns the metadata and nil. // Otherwise, it returns either a context error or a ClosedError. Info(ctx context.Context) (*Info, error) // InfoStream subscribes to updates to log metadata. InfoStream continues until // it encounters an error. Then it closes infoCh and returns either a context // error or a ClosedError. InfoStream(ctx context.Context, infoCh chan<- *Info) error }
A AkutanLog is a client to Akutan's data log.
type ClosedError ¶
type ClosedError struct{}
A ClosedError is returned when attempting to use a AkutanLog after the log's background context has been canceled. This error indicates the AkutanLog instance is no longer useful and the process is likely shutting down.
func (ClosedError) Error ¶
func (err ClosedError) Error() string
Error implements the method defined by 'error'.
type Disconnector ¶
type Disconnector interface { // Disconnect closes the connection to the current server, without blocking. The // AkutanLog instance remains usable; it will automatically re-connect as needed. // // This is used by the logping package to measure the latency of different log // servers. Disconnect() }
Disconnector is an optional interface that some AkutanLog implementations provide.
type Factory ¶
type Factory = func(ctx context.Context, cfg *config.Akutan, servers discovery.Locator) (AkutanLog, error)
A Factory creates a AkutanLog instance. The only errors returned are fatal errors in the configuration.
A factory returns immediately. The given context is used for all background activity. Canceling it will close any connections to the log servers, abort current requests, and prevent future requests from opening new connections.
Note, however, that the Kafka factory is not well-behaved at this time.
type TruncatedError ¶
type TruncatedError struct { // The needed index that no longer exists. Requested Index }
A TruncatedError is returned from Read when attempting to fetch deleted log entries.
func (TruncatedError) Error ¶
func (err TruncatedError) Error() string
Error implements the method defined by 'error'.
Directories ¶
Path | Synopsis |
---|---|
Package kafka implements a Kafka client as a blog.AkutanLog.
|
Package kafka implements a Kafka client as a blog.AkutanLog. |
Package logspecclient implements a client for the akutan/logspec API.
|
Package logspecclient implements a client for the akutan/logspec API. |
Package mockblog contains an in-process, in-memory implementation of a Akutan log client and server.
|
Package mockblog contains an in-process, in-memory implementation of a Akutan log client and server. |