store

package
v0.0.0-...-08a93fc Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Disk-backed queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	io.Writer
	io.ReaderAt
	Destroy()
	LastWriteAt() time.Time
	LastReadAt() time.Time
}

type LocalFileDataStore

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

func NewLocalFileDataStore

func NewLocalFileDataStore(dir, name string) (ds *LocalFileDataStore)

func (*LocalFileDataStore) Destroy

func (ds *LocalFileDataStore) Destroy()

func (*LocalFileDataStore) LastReadAt

func (ds *LocalFileDataStore) LastReadAt() time.Time

func (*LocalFileDataStore) LastWriteAt

func (ds *LocalFileDataStore) LastWriteAt() time.Time

func (*LocalFileDataStore) ReadAt

func (ds *LocalFileDataStore) ReadAt(data []byte, offset int64) (int, error)

func (*LocalFileDataStore) Write

func (ds *LocalFileDataStore) Write(data []byte) (int, error)

type SingleFileStore

type SingleFileStore struct {
	// Filename is the file to write logs to.  Backup log files will be retained
	// in the same directory.
	Filename string

	Offset   int64 // offset at the head of the file
	Position int64 // offset for current tail, write position
	// contains filtered or unexported fields
}

func (*SingleFileStore) Close

func (l *SingleFileStore) Close() error

Close implements io.Closer, and closes the current logfile.

func (*SingleFileStore) Destroy

func (l *SingleFileStore) Destroy()

func (*SingleFileStore) ReadAt

func (l *SingleFileStore) ReadAt(data []byte, offset int64) (int, error)

func (*SingleFileStore) Write

func (l *SingleFileStore) Write(p []byte) (n int, err error)

Write implements io.Writer. If a write would cause the log file to be larger than MaxMegaByte, the file is closed, renamed to include a timestamp of the current time, and a new log file is created using the original log file name. If the length of the write is greater than MaxMegaByte, an error is returned.

Jump to

Keyboard shortcuts

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