kvs

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTempDir creates temp dir.
	DefaultTempDir = createTempDir()
	// DefaultMaxSize for data size.
	DefaultMaxSize int64 = 64 * 1024 * 1024
)

Functions

func ExtractArchive

func ExtractArchive(src, dst string) error

ExtractArchive extracts by archive.

func IsFileExist

func IsFileExist(p string) bool

IsFileExist checks file exists.

Types

type Config

type Config struct {
}

Config struct.

type Consul

type Consul struct {
	Host     string
	Port     int
	Password string
	// contains filtered or unexported fields
}

Consul struct.

func (*Consul) Delete

func (c *Consul) Delete(key string)

Delete data on Consul.

func (*Consul) List

func (c *Consul) List()

List returns key from Consul.

func (*Consul) Read

func (c *Consul) Read(key string)

Read data on Consul.

func (*Consul) Write

func (c *Consul) Write(data string)

Write data to Consul.

type File

type File struct {
	MaxItems int
	MaxSize  int64
	// contains filtered or unexported fields
}

File struct.

func (*File) Default

func (f *File) Default()

Default sets to struct.

func (*File) Delete

func (f *File) Delete(key string) error

Delete data on file.

func (*File) GetDir

func (f *File) GetDir() string

GetDir returns dir.

func (*File) List

func (f *File) List() ([]string, error)

List returns keys from file.

func (*File) Read

func (f *File) Read(key string) ([]byte, error)

Read data by key from file.

func (*File) Write

func (f *File) Write(key string, data []byte) error

Write data to file.

type KVS

type KVS interface {
	Read(key string) ([]byte, error)
	Write(key string, data []byte) error
	Delete(key string) error
	List() ([]string, error)
	GetDir() string
}

KVS interface.

func New

func New(t string, c Config) (KVS, error)

New returns KVS.

type Memory

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

Memory struct.

func (*Memory) Delete

func (m *Memory) Delete(key string) bool

Delete data by key on memory.

func (*Memory) List

func (m *Memory) List()

List returns keys from memory.

func (*Memory) Read

func (m *Memory) Read(key string) string

Read data by key on memory.

func (*Memory) Write

func (m *Memory) Write(data string) bool

Write data to memory.

type Redis

type Redis struct {
	Host     string
	Port     int
	Password string
	TTL      int
	// contains filtered or unexported fields
}

Redis struct.

func (*Redis) Delete

func (r *Redis) Delete(key string)

Delete key on redis.

func (*Redis) List

func (r *Redis) List()

List returns keys from redis.

func (*Redis) Read

func (r *Redis) Read(key string)

Read data by key on redis.

func (*Redis) Write

func (r *Redis) Write(data string)

Write data to redis.

Jump to

Keyboard shortcuts

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