storage

package
v0.0.0-...-3491b9c Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileStorageType  = 1
	RedisStorageType = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FilePosStorage

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

func NewFilePosStorage

func NewFilePosStorage(filepath string) (*FilePosStorage, error)

func (*FilePosStorage) Close

func (s *FilePosStorage) Close()

func (*FilePosStorage) Get

func (s *FilePosStorage) Get() (*Position, error)

func (*FilePosStorage) Rewrite

func (s *FilePosStorage) Rewrite(pos *Position) error

type IPosStorage

type IPosStorage interface {
	Get() (*Position, error)
	Rewrite(pos *Position) error
	Close()
}

func NewPosStorage

func NewPosStorage(storageCfg PosStorageConfig) (IPosStorage, error)

type PosStorageConfig

type PosStorageConfig struct {
	StorageType int
	FileConfig  struct {
		Filepath string
	}
	RedisConfig struct {
		Uri string
	}
}

type Position

type Position struct {
	Name string `json:"name"`
	Pos  uint32 `json:"pos"`
}

type RedisPosStorage

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

func NewRedisPosStorage

func NewRedisPosStorage(uri string) (*RedisPosStorage, error)

func (*RedisPosStorage) Close

func (s *RedisPosStorage) Close()

func (*RedisPosStorage) Get

func (s *RedisPosStorage) Get() (*Position, error)

func (*RedisPosStorage) Rewrite

func (s *RedisPosStorage) Rewrite(pos *Position) error

Jump to

Keyboard shortcuts

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