Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages a set of LogStreamAppenders. When multiple users attempt to obtain the same LogStreamAppender using the same TopicID and LogStreamID, they may share the same object. Therefore, when one user calls the Close function, another may encounter an ErrClose error. To resolve this issue, users can simply get a new LogStreamAppender by calling the Get function again.
func New ¶
func New(vcli varlog.Log, opts ...varlog.LogStreamAppenderOption) *Manager
New returns a new Manager. Generally, users only require one manager.
func (*Manager) Any ¶
func (mgr *Manager) Any(tpid types.TopicID, allowlist map[types.LogStreamID]struct{}) (varlog.LogStreamAppender, error)
Any returns the LogStreamAppender that is filtered by the argument allowlist. If the allowlist is empty, all log streams in the topic can be chosen. It chooses the writable LogStreamAppender as possible.
func (*Manager) Clear ¶ added in v0.15.0
func (mgr *Manager) Clear()
Clear closes all the managed LogStreamAppender, and clears them. Clients can continue to use this Manager after calling Clear.
After using the Manager, clients should call Clear to release any associated resources.
func (*Manager) Get ¶
func (mgr *Manager) Get(tpid types.TopicID, lsid types.LogStreamID) (varlog.LogStreamAppender, error)
Get returns a LogStreamAppender specified by the arguments tpid and lsid. It returns an error if it cannot access the given log stream.