sofile

package
v0.0.0-...-d9d0c30 Latest Latest
Warning

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

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

Documentation

Overview

存在用泛型稳定后,改用泛型实现key的替换,key 只需要 comparable(int, string...)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFileTime

func SetFileTime(path string, atime, ctime, mtime time.Time) (err error)

Set the access, creation, and modification times of a file.

Types

type Blockfile

type Blockfile struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewBlockfile

func NewBlockfile(path string, initBlocks interface{}) (*Blockfile, error)

创建文件数据块存储

func (*Blockfile) Add

func (bf *Blockfile) Add(key string, block interface{}) error

增加一个数据块

func (*Blockfile) BatchLoad

func (bf *Blockfile) BatchLoad(blocks interface{}) error

批量加载数据

func (*Blockfile) Clean

func (bf *Blockfile) Clean()

清除数据

func (*Blockfile) Delete

func (bf *Blockfile) Delete(key string) error

删除一个数据块

func (*Blockfile) Destroy

func (bf *Blockfile) Destroy()

摧毁整个结构

func (*Blockfile) Get

func (bf *Blockfile) Get(key string) (out interface{}, exist bool)

得到一个数据块

func (*Blockfile) GetBlocks

func (bf *Blockfile) GetBlocks() interface{}

返回现存的数据块

func (*Blockfile) GetLen

func (bf *Blockfile) GetLen() int

数据长度

func (*Blockfile) Update

func (bf *Blockfile) Update(key string, block interface{}) error

更新一个数据块

Jump to

Keyboard shortcuts

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