db

package
v0.0.0-...-3cbc9b2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2015 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BBOOL

func BBOOL(TYPE Verb, verb Verb) bool

Types

type ActType

type ActType uint32

type Dir

type Dir struct {
	Value string                 `json:"value"`
	Abs   string                 `json:"abs"`
	Attr  Verb                   `json:"attr"`
	Files map[string]interface{} `json:"files"`
	// contains filtered or unexported fields
}

watch is only for files, not for dir

func NewDir

func NewDir(abs string, value string) *Dir

func (*Dir) Add

func (dir *Dir) Add(path string, add int) (string, Err)

func (*Dir) AddDirNum

func (dir *Dir) AddDirNum(num int)

func (*Dir) AddFileNum

func (dir *Dir) AddFileNum(num int)

func (*Dir) Create

func (dir *Dir) Create(path string, value string, attr Verb) Err

func (*Dir) Del

func (dir *Dir) Del(path string) Err

func (*Dir) DelWithPat

func (dir *Dir) DelWithPat(path string) (map[string]interface{}, Err)

func (*Dir) Get

func (dir *Dir) Get(path string) (string, Verb, Err)

func (*Dir) GetWithPat

func (dir *Dir) GetWithPat(path string) (map[string]interface{}, Err)

func (*Dir) IsDir

func (dir *Dir) IsDir(path string) (bool, Err)

func (*Dir) MkDir

func (dir *Dir) MkDir(path string, value string) Err

func (*Dir) Set

func (dir *Dir) Set(path string, value string) Err

type File

type File struct {
	Value string `json:"value"`
	Name  string `json:"name"`
	Attr  Verb   `json:"attr"`
	// contains filtered or unexported fields
}

func NewFile

func NewFile(name string, value string) *File

func (*File) AddFileNum

func (file *File) AddFileNum(num int)

func (*File) GetPath

func (file *File) GetPath() string

func (*File) RemoveFromDir

func (file *File) RemoveFromDir()

type Fs

type Fs struct {
	//watch 需要再搞个watchRoot
	Root *Dir
	// contains filtered or unexported fields
}

The key-value database.

func NewFs

func NewFs(notify FsNotify) *Fs

Creates a new database.

func (*Fs) Add

func (fs *Fs) Add(key string, numStr string) (string, Err)

Inc: fist set k:v with Inc Attr, and then call inc Sets the value for a given key.

func (*Fs) Apply

func (fs *Fs) Apply(path string, value string, verb uint32, addr string) (interface{}, error)

func (*Fs) Create

func (fs *Fs) Create(key string, value string, attr Verb, tempDataId_IP string) Err

func (*Fs) Del

func (fs *Fs) Del(key string) Err

Sets the value for a given key.

func (*Fs) DelWatch

func (fs *Fs) DelWatch(path string, ip string)

func (*Fs) DelWatchAllWithIp

func (fs *Fs) DelWatchAllWithIp(ip string)

func (*Fs) DelWithPat

func (fs *Fs) DelWithPat(key string) (map[string]interface{}, Err)

Sets the value for a given key.

func (*Fs) DelWithPatStr

func (fs *Fs) DelWithPatStr(key string) (string, Err)

func (*Fs) Dir

func (fs *Fs) Dir() *Dir

func (*Fs) DirNum

func (fs *Fs) DirNum() int

func (*Fs) Encode

func (fs *Fs) Encode() string

Sets the value for a given key.

func (*Fs) FileNum

func (fs *Fs) FileNum() int

func (*Fs) Get

func (fs *Fs) Get(key string, pat bool) (string, Verb, Err)

Retrieves the value for a given key.

func (*Fs) GetFsData

func (fs *Fs) GetFsData() ([]byte, Err)

func (*Fs) GetWithPat

func (fs *Fs) GetWithPat(key string) (map[string]interface{}, Err)

// Retrieves the value for a given key.

func (*Fs) IsDir

func (fs *Fs) IsDir(key string) (bool, Err)

Sets the value for a given key.

func (*Fs) MkDir

func (fs *Fs) MkDir(key string, value string) Err

Sets the value for a given key.

func (*Fs) RemoveTempData

func (fs *Fs) RemoveTempData(tempDataId_IP string)

func (*Fs) Set

func (fs *Fs) Set(key string, value string) Err

Sets the value for a given key.

func (*Fs) SetFsData

func (fs *Fs) SetFsData(bytes []byte) Err

func (*Fs) SetWatch

func (fs *Fs) SetWatch(path string, ip string, tag string, immediate bool)

Sets the value for a given key.

type FsNotify

type FsNotify func(key string, value string, tag string, verb Verb, ip string, watchPath string)

type OpType

type OpType int
const (
	OpMkDirAll OpType = iota
	OpMkAutoMkDirAndLastFile
	OpGet
	OpDel
	OpPatDel
	OpPatGet
)

Jump to

Keyboard shortcuts

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