object

package
v0.0.0-...-712f093 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2015 License: GPL-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OBJECT_T    = iota
	NAMESPACE_T = iota
)

Variables

View Source
var CaseSensitive bool = false
View Source
var IndexOffset int = 0
View Source
var IndexParent bool = true
View Source
var IndexSize int = 20

Functions

This section is empty.

Types

type AtomicInt64

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

func NewAtomicInt64

func NewAtomicInt64(init int64) *AtomicInt64

func (*AtomicInt64) Caculate

func (ai *AtomicInt64) Caculate(delta int64) int64

func (*AtomicInt64) Value

func (ai *AtomicInt64) Value() int64

type BleveIndexes

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

func NewBleveIndexes

func NewBleveIndexes(indexRoot string, indexName string) *BleveIndexes

func (*BleveIndexes) CreateIndex

func (indexes *BleveIndexes) CreateIndex(namespace string) error

func (*BleveIndexes) Delete

func (indexes *BleveIndexes) Delete(uri string) error

func (*BleveIndexes) Index

func (indexes *BleveIndexes) Index(uri string, value interface{}) error

func (*BleveIndexes) IndexIfNotExist

func (indexes *BleveIndexes) IndexIfNotExist(uri string, value interface{}) error

func (*BleveIndexes) Query

func (indexes *BleveIndexes) Query(namespace string, query interface{}, offset int64, size int64) (int64, []string, error)

func (*BleveIndexes) RemoveIndex

func (indexes *BleveIndexes) RemoveIndex(namespace string) error

type BoltCoder

type BoltCoder struct{}

func (BoltCoder) Decode

func (bc BoltCoder) Decode(value []byte) (interface{}, error)

func (BoltCoder) Encode

func (bc BoltCoder) Encode(value interface{}) ([]byte, error)

type BoltStore

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

func NewBoltStore

func NewBoltStore(root string, name string, coder ByteCoder) *BoltStore

func (*BoltStore) Del

func (store *BoltStore) Del(uri string) error

func (*BoltStore) DelOBJECT

func (store *BoltStore) DelOBJECT(object OBJECT) error

func (*BoltStore) Get

func (store *BoltStore) Get(uri string, nested bool) (interface{}, error)

func (*BoltStore) GetOBJECT

func (store *BoltStore) GetOBJECT(uri string) (OBJECT, error)

func (*BoltStore) Load

func (store *BoltStore) Load() error

func (*BoltStore) MultiGet

func (store *BoltStore) MultiGet(uri string, suffix string, nested bool) ([]interface{}, error)

func (*BoltStore) Put

func (store *BoltStore) Put(uri string, value interface{}) error

func (*BoltStore) PutOBJECT

func (store *BoltStore) PutOBJECT(object OBJECT) error

func (*BoltStore) Size

func (store *BoltStore) Size(uri string) (int64, error)

type ByteCoder

type ByteCoder interface {
	Decode(value []byte) (interface{}, error)
	Encode(value interface{}) ([]byte, error)
}

type Cache

type Cache interface {
	Set(string, interface{}, time.Duration)
	Add(string, interface{}, time.Duration) error
	Get(string) (interface{}, bool)
	Delete(string)
	DeleteExpired()
}

type Indexes

type Indexes interface {
	CreateIndex(namespace string) error
	RemoveIndex(namespace string) error
	Delete(uri string) error
	Index(uri string, value interface{}) error
	IndexIfNotExist(uri string, value interface{}) error
	Query(namespace string, query interface{}, offset int64, size int64) (int64, []string, error)
}

type MemoryCache

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

func NewMutexCache

func NewMutexCache(defaultExpiration time.Duration, cleanupInterval time.Duration) *MemoryCache

func (*MemoryCache) Add

func (c *MemoryCache) Add(k string, v interface{}, exp time.Duration) error

func (*MemoryCache) Delete

func (c *MemoryCache) Delete(k string)

func (*MemoryCache) DeleteExpired

func (c *MemoryCache) DeleteExpired()

func (*MemoryCache) Get

func (c *MemoryCache) Get(k string) (interface{}, bool)

func (*MemoryCache) Set

func (c *MemoryCache) Set(k string, v interface{}, exp time.Duration)

type Namespace

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

func NewNamespace

func NewNamespace(ns string) (*Namespace, error)

func (*Namespace) AddObject

func (ns *Namespace) AddObject(obj OBJECT) error

func (*Namespace) Del

func (ns *Namespace) Del(key string)

func (*Namespace) DelObject

func (ns *Namespace) DelObject(obj OBJECT)

func (*Namespace) GetBytes

func (ns *Namespace) GetBytes(bc ByteCoder) ([]byte, error)

func (*Namespace) GetValue

func (ns *Namespace) GetValue(uri string, ret interface{}) error

func (*Namespace) Key

func (ns *Namespace) Key() string

func (*Namespace) MarshalJSON

func (ns *Namespace) MarshalJSON() ([]byte, error)

implement json marshal only object value

func (*Namespace) Namespace

func (ns *Namespace) Namespace() string

func (*Namespace) Set

func (ns *Namespace) Set(key string, val interface{}) error

func (*Namespace) SetBytes

func (ns *Namespace) SetBytes(bc ByteCoder, byts []byte) error

func (*Namespace) SetValue

func (ns *Namespace) SetValue(value interface{}) error

func (*Namespace) Type

func (ns *Namespace) Type() OBJECT_TYPE

func (*Namespace) URI

func (ns *Namespace) URI() string

func (*Namespace) Value

func (ns *Namespace) Value() interface{}

type OBJECT

type OBJECT interface {
	Namespace() string
	Key() string
	URI() string
	Type() OBJECT_TYPE
	Value() interface{}
	GetBytes(bc ByteCoder) ([]byte, error)
	SetBytes(bc ByteCoder, bytes []byte) error
	SetValue(value interface{}) error
	GetValue(uri string, ret interface{}) error
}

func CreateOBJECTByType

func CreateOBJECTByType(uri string, atype OBJECT_TYPE) (OBJECT, error)

func CreateOBJECTByValue

func CreateOBJECTByValue(uri string, value interface{}) (OBJECT, error)

type OBJECT_TYPE

type OBJECT_TYPE int

type Object

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

func NewObject

func NewObject(namespace, key string) (*Object, error)

func NewObjectByURI

func NewObjectByURI(uri string) (*Object, error)

func (*Object) GetBytes

func (obj *Object) GetBytes(bc ByteCoder) ([]byte, error)

func (*Object) GetValue

func (obj *Object) GetValue(uri string, ret interface{}) error

func (*Object) Key

func (obj *Object) Key() string

func (*Object) MarshalJSON

func (obj *Object) MarshalJSON() ([]byte, error)

implement json marshal only object value

func (*Object) Namespace

func (obj *Object) Namespace() string

func (*Object) SetBytes

func (obj *Object) SetBytes(bc ByteCoder, byts []byte) error

func (*Object) SetValue

func (obj *Object) SetValue(value interface{}) error

func (*Object) Type

func (obj *Object) Type() OBJECT_TYPE

func (*Object) URI

func (obj *Object) URI() string

func (*Object) Value

func (obj *Object) Value() interface{}

type Store

type Store interface {
	PutOBJECT(obj OBJECT) error
	GetOBJECT(uri string) (OBJECT, error)
	DelOBJECT(obj OBJECT) error

	Put(uri string, val interface{}) error
	Get(uri string, nested bool) (interface{}, error)
	Del(uri string) error

	MultiGet(uri string, suffix string, nested bool) ([]interface{}, error)

	Size(uri string) (int64, error)
}

Jump to

Keyboard shortcuts

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