store

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureRunIdStore

func EnsureRunIdStore(root, runId string) error

func ExistReplId

func ExistReplId(root, id string) bool

func MkdirIfNoExist

func MkdirIfNoExist(dir string) error

Types

type AofReader

type AofReader struct {
	// contains filtered or unexported fields
}

func NewAofReader

func NewAofReader(fp string) (*AofReader, error)

func (*AofReader) Close

func (rd *AofReader) Close() (err error)

func (*AofReader) Verify

func (rd *AofReader) Verify() error

type AofRotateReader

type AofRotateReader struct {
	// contains filtered or unexported fields
}

func NewAofRotateReader

func NewAofRotateReader(dir string, offset int64, aof aofStorer, writer io.WriteCloser, verifyCrc bool) (*AofRotateReader, error)

func (*AofRotateReader) Close

func (r *AofRotateReader) Close() error

func (*AofRotateReader) Seek

func (r *AofRotateReader) Seek(offset int64) error

offset is a logical offset

func (*AofRotateReader) SetObserver

func (r *AofRotateReader) SetObserver(obr Observer)

func (*AofRotateReader) Start

func (r *AofRotateReader) Start()

func (*AofRotateReader) Wait

func (r *AofRotateReader) Wait(ctx context.Context) error

type AofRotater

type AofRotater struct {
	Id string
	// contains filtered or unexported fields
}

AofRotater it is not thread safe,

func NewAofRotater

func NewAofRotater(id string, dir string, offset int64, maxLogSize int64, flush config.FlushPolicy) (*AofRotater, error)

type AofWriter

type AofWriter struct {
	*AofRotater
	// contains filtered or unexported fields
}

func NewAofWriter

func NewAofWriter(id string, dir string, offset int64, reader io.Reader, maxLogSize int64, flushPolicy config.FlushPolicy) (*AofWriter, error)

func (*AofWriter) Close

func (w *AofWriter) Close() error

func (*AofWriter) Right

func (w *AofWriter) Right() int64

func (*AofWriter) SetObserver

func (w *AofWriter) SetObserver(obsr Observer)

func (*AofWriter) Start

func (w *AofWriter) Start()

func (*AofWriter) Wait

func (w *AofWriter) Wait(ctx context.Context) error

type Observer

type Observer interface {
	Open(args ...interface{})
	Close(args ...interface{})
	Write(args ...interface{})
	Read(args ...interface{})
}

type RdbFile

type RdbFile struct {
	// contains filtered or unexported fields
}

func ParseRdbFile

func ParseRdbFile(name string, includeTmpRdb bool) *RdbFile

func (*RdbFile) IsValid

func (rf *RdbFile) IsValid() bool

type RdbReader

type RdbReader struct {
	// contains filtered or unexported fields
}

func NewRdbReader

func NewRdbReader(w io.WriteCloser, rdbDir string, offset int64, rdbSize int64, verifyCrc bool) (*RdbReader, error)

func NewRdbReaderFromFile added in v1.0.0

func NewRdbReaderFromFile(w io.WriteCloser, rdbFilePath string, verifyCrc bool) (*RdbReader, error)

func (*RdbReader) Close

func (r *RdbReader) Close() error

func (*RdbReader) GetReader added in v1.0.3

func (r *RdbReader) GetReader() *os.File

func (*RdbReader) SetObserver

func (r *RdbReader) SetObserver(o Observer)

func (*RdbReader) Size added in v1.0.0

func (r *RdbReader) Size() int64

func (*RdbReader) Start

func (r *RdbReader) Start()

func (*RdbReader) Wait

func (r *RdbReader) Wait(ctx context.Context) error

type RdbWriter

type RdbWriter struct {
	// contains filtered or unexported fields
}

func NewRdbWriter

func NewRdbWriter(id string, r io.Reader, rdbDir string, offset int64, rdbSize int64) (*RdbWriter, error)

rdb name : sourceDir/$runId/$rdbDir/$offset_size.rdb

func (*RdbWriter) Close

func (r *RdbWriter) Close() error

func (*RdbWriter) Offset

func (s *RdbWriter) Offset() int64

func (*RdbWriter) SetObserver

func (r *RdbWriter) SetObserver(obr Observer)

func (*RdbWriter) Start

func (rw *RdbWriter) Start()

func (*RdbWriter) Wait

func (r *RdbWriter) Wait(ctx context.Context) error

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader added in v1.0.0

func NewReader(reader *bufio.Reader, rdb *RdbReader, aof *AofRotateReader,
	left int64, size int64, runId string) *Reader

func (*Reader) Close added in v1.0.3

func (r *Reader) Close()

func (*Reader) IoReader

func (r *Reader) IoReader() *bufio.Reader

func (*Reader) IsAof

func (r *Reader) IsAof() bool

func (*Reader) Left

func (r *Reader) Left() int64

func (*Reader) RunId

func (r *Reader) RunId() string

func (*Reader) Size

func (r *Reader) Size() int64

Size : returns data size -1 means an endless reader

func (*Reader) Start

func (r *Reader) Start(wait usync.WaitCloser)

type Storer

type Storer struct {
	Id string
	// contains filtered or unexported fields
}

func NewStorer

func NewStorer(id string, baseDir string, maxSize, logSize int64, flush config.FlushPolicy) *Storer

func (*Storer) Close

func (s *Storer) Close() error

func (*Storer) DelRunId

func (s *Storer) DelRunId(id string) error

func (*Storer) GetAofWritter

func (s *Storer) GetAofWritter(r io.Reader, offset int64) (*AofWriter, error)

func (*Storer) GetOffsetRange

func (s *Storer) GetOffsetRange() (int64, int64)

func (*Storer) GetRdb

func (s *Storer) GetRdb() (int64, int64)

func (*Storer) GetRdbWriter

func (s *Storer) GetRdbWriter(r io.Reader, offset int64, rdbSize int64) (*RdbWriter, error)

func (*Storer) GetReader

func (s *Storer) GetReader(offset int64, verifyCrc bool) (*Reader, error)

for a rdb writer, Reader returns io.EOF when data has been drained for a aof writer, it's endless unless encounter an error

func (*Storer) IsValidOffset

func (s *Storer) IsValidOffset(offset int64) bool

func (*Storer) LatestOffset

func (s *Storer) LatestOffset() int64

func (*Storer) RunId

func (s *Storer) RunId() string

func (*Storer) SetRunId

func (s *Storer) SetRunId(new string) error

func (*Storer) VerifyRunId

func (s *Storer) VerifyRunId(ids []string) (offset int64, err error)

Jump to

Keyboard shortcuts

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