Documentation
¶
Index ¶
- Constants
- Variables
- type Appender
- type OptionFunc
- type Reader
- type Storage
- func (s *Storage) Append(ctx context.Context, namespace string, r io.Reader) (index int64, size int64, err error)
- func (s *Storage) Close() error
- func (s *Storage) Details(namespace string) (string, error)
- func (s *Storage) Stream(ctx context.Context, namespace string, startPos int64) Stream
- func (s *Storage) Verify(namespace string) error
- type Stream
Constants ¶
View Source
const ( FileHeaderSize = 8 + 8 // total number of messages + index of the last message RecordHeaderSize = 8 // size of the content of the message )
Variables ¶
View Source
var ( ErrNamespaceRequired = errors.New("namespace is required") ErrNamesapceNotFound = errors.New("namespace not found") )
Functions ¶
This section is empty.
Types ¶
type Appender ¶
type Appender interface { // Append writes the content of the reader to the storage medium. // and returns the index and size of the content written. Append(ctx context.Context, r io.Reader) (index int64, size int64, err error) }
Appender is a single method interface that writes the content of the reader to the storage medium.
type OptionFunc ¶ added in v0.0.4
type OptionFunc func(*options) error
func WithFastWrite ¶
func WithFastWrite(fast bool) OptionFunc
func WithLogsDirPath ¶ added in v0.0.4
func WithLogsDirPath(path string) OptionFunc
func WithNamespaces ¶ added in v0.0.4
func WithNamespaces(namespaces ...string) OptionFunc
func WithReaderCount ¶ added in v0.0.4
func WithReaderCount(count int) OptionFunc
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func New ¶
func New(optFns ...OptionFunc) (*Storage, error)
type Stream ¶
type Stream interface { // Creates a io.Reader and provide the size of the content ahead of time. // If there is no more content to read, it will blocked until there is more content or the context is done. Next(ctx context.Context) (r *Reader, size int64, err error) // Done should be called to release the reader. // the best practice is once an stream is created successfully, call Done in defer. Done() }
Stream is an interface that deals with reading from the storage medium.
Click to show internal directories.
Click to hide internal directories.