Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUpstreamClosed = errors.New("upstream closed")
Functions ¶
This section is empty.
Types ¶
type AppendResult ¶
type AppendResult = types.AppendResult
type HandleParam ¶
type HandleParam struct { Ctx context.Context Upstream <-chan message.ImmutableMessage Message message.ImmutableMessage TimeTickChan <-chan struct{} }
type HandleResult ¶
type HandleResult struct { Incoming message.ImmutableMessage // Not nil if upstream return new message. MessageHandled bool // True if Message is handled successfully. TimeTickUpdated bool // True if TimeTickChan is triggered. Error error // Error is context is canceled. }
type MessageFilter ¶
type MessageFilter = func(message.ImmutableMessage) bool
type MessageHandler ¶
type MessageHandler interface { // Handle is the callback for handling message. Handle(param HandleParam) HandleResult // Close is called after all messages are handled or handling is interrupted. Close() }
MessageHandler is used to handle message read from log. TODO: should be removed in future after msgstream is removed.
type OpenOption ¶
type OpenOption struct {
Channel types.PChannelInfo
}
OpenOption is the option for allocating wal instance.
type Opener ¶
type Opener interface { // Open open a wal instance. Open(ctx context.Context, opt *OpenOption) (WAL, error) // Close closes the opener resources. Close() }
Opener is the interface for build wal instance.
type OpenerBuilder ¶
type OpenerBuilder interface { // Name of the wal builder, should be a lowercase string. Name() string Build() (Opener, error) }
OpenerBuilder is the interface for build wal opener.
type ReadOption ¶
type ReadOption struct { VChannel string // vchannel name DeliverPolicy options.DeliverPolicy MessageFilter []options.DeliverFilter MesasgeHandler MessageHandler // message handler for message processing. }
ReadOption is the option for reading records from the wal.
type Scanner ¶
type Scanner interface { // Chan returns the channel of message if Option.MessageHandler is nil. Chan() <-chan message.ImmutableMessage // Channel returns the channel assignment info of the wal. Channel() types.PChannelInfo // Error returns the error of scanner failed. // Will block until scanner is closed or Chan is dry out. Error() error // Done returns a channel which will be closed when scanner is finished or closed. Done() <-chan struct{} // Close the scanner, release the underlying resources. // Return the error same with `Error` Close() error }
Scanner is the interface for reading records from the wal.
type WAL ¶
type WAL interface { WALName() string // Channel returns the channel assignment info of the wal. Channel() types.PChannelInfo // Append writes a record to the log. Append(ctx context.Context, msg message.MutableMessage) (*AppendResult, error) // Append a record to the log asynchronously. AppendAsync(ctx context.Context, msg message.MutableMessage, cb func(*AppendResult, error)) // Read returns a scanner for reading records from the wal. Read(ctx context.Context, deliverPolicy ReadOption) (Scanner, error) // Available return a channel that will be closed when the wal is available. Available() <-chan struct{} // IsAvailable returns if the wal is available. IsAvailable() bool // Close closes the wal instance. Close() }
WAL is the WAL framework interface. !!! Don't implement it directly, implement walimpls.WAL instead.
Click to show internal directories.
Click to hide internal directories.