stream

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAGIC_HEADER = "ESDBstream"
	MAGIC_FOOTER = "closedESDBstream"
)

Variables

View Source
var CORRUPTED_EVENT = errors.New("corrupted event")
View Source
var CORRUPTED_HEADER = errors.New("Incorrect stream file header.")
View Source
var FOOTER_LENGTH = int64(len(MAGIC_FOOTER))
View Source
var HEADER_LENGTH = int64(len(MAGIC_HEADER))
View Source
var WRITING_TO_CLOSED_STREAM = errors.New("stream has been closed")

Functions

func Merge

func Merge(destination string, streams []string) error

func Serialize

func Serialize(data []byte, indexes map[string]string, tails map[string]int64) ([]byte, error)

Types

type Event

type Event struct {
	Data []byte
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent(data []byte, offsets map[string]int64) *Event

func (*Event) Indexes

func (e *Event) Indexes() map[string]string

func (*Event) Next

func (e *Event) Next(name, value string) int64

type Scanner

type Scanner func(*Event) bool

type Stream

type Stream interface {
	Write(data []byte, indexes map[string]string) (int, error)
	First(name, value string) (int64, error)
	ScanIndex(name, value string, offset int64, scanner Scanner) error
	Iterate(offset int64, scanner Scanner) (int64, error)
	Offset() int64
	Closed() bool
	Close() error
	// contains filtered or unexported methods
}

func New

func New(path string) (Stream, error)

Creates a new open stream at the given path. If the file already exists, an error will be returned.

func Open

func Open(path string) (Stream, error)

type Streamer

type Streamer interface {
	io.WriterAt
	io.ReaderAt
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL