internal

package
v0.4.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OperationTotalCounterVec = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "litestream_replica_operation_total",
		Help: "The number of replica operations performed",
	}, []string{"replica_type", "operation"})

	OperationBytesCounterVec = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "litestream_replica_operation_bytes",
		Help: "The number of bytes used by replica operations",
	}, []string{"replica_type", "operation"})
)

Shared replica metrics.

Functions

func CreateFile added in v0.3.5

func CreateFile(filename string, fi os.FileInfo) (*os.File, error)

CreateFile creates the file and matches the mode & uid/gid of fi.

func Fileinfo added in v0.3.5

func Fileinfo(fi os.FileInfo) (uid, gid int)

Fileinfo returns syscall fields from a FileInfo object.

func MkdirAll added in v0.3.5

func MkdirAll(path string, fi os.FileInfo) error

MkdirAll is a copy of os.MkdirAll() except that it attempts to set the mode/uid/gid to match fi for each created directory.

func ParseSnapshotPath

func ParseSnapshotPath(s string) (index int, err error)

ParseSnapshotPath parses the index from a snapshot filename. Used by path-based replicas.

func ParseWALSegmentPath

func ParseWALSegmentPath(s string) (index int, offset int64, err error)

ParseWALSegmentPath parses the index/offset from a segment filename. Used by path-based replicas.

Types

type MultiReadCloser

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

MultiReadCloser is a logical concatenation of io.ReadCloser. It works like io.MultiReader except all objects are closed when Close() is called.

func NewMultiReadCloser

func NewMultiReadCloser(a []io.ReadCloser) *MultiReadCloser

NewMultiReadCloser returns a new instance of MultiReadCloser.

func (*MultiReadCloser) Close

func (mrc *MultiReadCloser) Close() (err error)

Close closes all underlying ReadClosers and returns first error encountered.

func (*MultiReadCloser) Read

func (mrc *MultiReadCloser) Read(p []byte) (n int, err error)

Read reads from the next available reader.

type ReadCloser

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

ReadCloser wraps a reader to also attach a separate closer.

func NewReadCloser

func NewReadCloser(r io.Reader, c io.Closer) *ReadCloser

NewReadCloser returns a new instance of ReadCloser.

func (*ReadCloser) Close

func (r *ReadCloser) Close() error

Close closes the reader (if implementing io.ReadCloser) and the Closer.

func (*ReadCloser) Read

func (r *ReadCloser) Read(p []byte) (n int, err error)

Read reads bytes into the underlying reader.

type ReadCounter added in v0.3.5

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

ReadCounter wraps an io.Reader and counts the total number of bytes read.

func NewReadCounter added in v0.3.5

func NewReadCounter(r io.Reader) *ReadCounter

NewReadCounter returns a new instance of ReadCounter that wraps r.

func (*ReadCounter) N added in v0.3.5

func (r *ReadCounter) N() int64

N returns the total number of bytes read.

func (*ReadCounter) Read added in v0.3.5

func (r *ReadCounter) Read(p []byte) (int, error)

Read reads from the underlying reader into p and adds the bytes read to the counter.

Jump to

Keyboard shortcuts

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