core

package
v0.0.0-...-d8f2f85 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// FixExt 閉じられたファイルの拡張子
	FixExt = ".fixed"
)

Variables

View Source
var (
	ErrTimePast = errors.New("Time is past.")
	ErrNotFound = errors.New("Key does not exist.")
)
View Source
var DefaultOptions = &FtailDBOptions{
	ReadOnly: false,
	Bin:      true,
}
View Source
var ErrUnknownPath = errors.New("Unknown path format.")

Functions

This section is empty.

Types

type DB

type DB struct {
	RealFilePath string
	Path         string
	Name         string
	Time         time.Time

	*FtailDB
	// contains filtered or unexported fields
}

func (*DB) Close

func (db *DB) Close(fix bool) error

func (*DB) Create

func (db *DB) Create(ext string, pos *Position) error

func (*DB) Delete

func (db *DB) Delete(ext string) error

func (*DB) GetPositon

func (db *DB) GetPositon() (pos Position, err error)

func (*DB) MakeFilefullPath

func (db *DB) MakeFilefullPath(ext string) string

func (*DB) MakeRealFilePath

func (db *DB) MakeRealFilePath(ext string) string

func (*DB) Open

func (db *DB) Open(ext string, pos *Position) error

type DBFiles

type DBFiles struct {
	Time time.Time
	Path string
}

func FixGlob

func FixGlob(db *DB) ([]DBFiles, error)

func Glob

func Glob(globPath string, pathToTime func(string) (time.Time, error)) ([]DBFiles, error)

func RecGlob

func RecGlob(db *DB) ([]DBFiles, error)

type DBpool

type DBpool struct {
	Path string
	Name string

	//outTime time.Time
	Period time.Duration // time.Minute
	// contains filtered or unexported fields
}

func (*DBpool) AllClose

func (r *DBpool) AllClose()

AllClose

func (*DBpool) Close

func (r *DBpool) Close(t time.Time, fix bool) error

Close

func (*DBpool) CloseOldDbs

func (r *DBpool) CloseOldDbs(t time.Time) (int, error)

func (*DBpool) CreateDB

func (r *DBpool) CreateDB(t time.Time, pos *Position) (*DB, error)

CreateDB

func (*DBpool) Init

func (r *DBpool) Init() (pos *Position, err error)

Init 最終のdbからPositionを読み込み

func (*DBpool) Put

func (r *DBpool) Put(row Row) error

Put

type Decoder

type Decoder interface {
	Decode(e interface{}) error
}

type FtailDB

type FtailDB struct {
	Pos      *Position
	PosError error
	// contains filtered or unexported fields
}

func FtailDBOpen

func FtailDBOpen(path string, mode os.FileMode, options *FtailDBOptions, pos *Position) (*FtailDB, error)

func (*FtailDB) Close

func (db *FtailDB) Close() error

func (*FtailDB) Put

func (db *FtailDB) Put(row Row) error

func (*FtailDB) ReadAll

func (db *FtailDB) ReadAll(w io.Writer) (int64, *Position, error)

type FtailDBOptions

type FtailDBOptions struct {
	ReadOnly bool
	Bin      bool
}

type InvalidFtailDBError

type InvalidFtailDBError struct {
	Line int
	File string
	S    string
}

func (*InvalidFtailDBError) Error

func (e *InvalidFtailDBError) Error() string

type Position

type Position struct {
	Name       string    `json:"n,omitempty"`
	CreateAt   time.Time `json:"ct,omitempty"`
	Offset     int64     `json:"o,omitempty"`
	HeadHash   string    `json:"h,omitempty"`
	HashLength int64     `json:"hl,omitempty"`
}

func GetPositon

func GetPositon(db *FtailDB) (Position, error)

func (Position) String

func (p Position) String() string

type Recorder

type Recorder struct {
	DBpool
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder(filePath, name string, period time.Duration) (*Recorder, error)

func (*Recorder) Position

func (r *Recorder) Position() *Position

type Row

type Row struct {
	Time time.Time `json:"t"`
	Pos  *Position `json:"p,omitempty"`
	Bin  []byte    `json:"b,omitempty"`
	Text string    `json:"s,omitempty"`
}

Jump to

Keyboard shortcuts

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