io

package
v0.0.0-...-6885dbb Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicBlockStore

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

DynamicBlockStore provides access to the blocks of a dynamic chunk store.

func (*DynamicBlockStore) BlockCount

func (store *DynamicBlockStore) BlockCount() (result uint16)

BlockCount returns the number of blocks available in the chunk. Flat chunks must contain exactly one block.

func (*DynamicBlockStore) BlockData

func (store *DynamicBlockStore) BlockData(block uint16) (result []byte)

BlockData returns the data for the requested block index.

func (*DynamicBlockStore) ContentType

func (store *DynamicBlockStore) ContentType() (result chunk.ContentType)

ContentType returns the type of the data.

func (*DynamicBlockStore) SetBlockData

func (store *DynamicBlockStore) SetBlockData(block uint16, data []byte)

SetBlockData sets the data for the requested block index.

type DynamicChunkStore

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

DynamicChunkStore wraps a chunk store instance that can be replaced during runtime. Access to the underlying store is synchronized.

func NewDynamicChunkStore

func NewDynamicChunkStore(wrapped chunk.Store, changeCallback func()) *DynamicChunkStore

NewDynamicChunkStore returns a new instance of a dynamic chunk store.

func (*DynamicChunkStore) Del

func (store *DynamicChunkStore) Del(id chunk.Identifier)

Del ensures the chunk with given identifier is deleted.

func (*DynamicChunkStore) Get

func (store *DynamicChunkStore) Get(id chunk.Identifier) (blockStore *DynamicBlockStore)

Get returns a chunk for the given identifier.

func (*DynamicChunkStore) IDs

func (store *DynamicChunkStore) IDs() []chunk.Identifier

IDs returns a list of available IDs this store currently contains.

func (*DynamicChunkStore) Put

func (store *DynamicChunkStore) Put(id chunk.Identifier, newChunk *chunk.Chunk)

Put (re-)assigns an identifier with data. If no chunk with given ID exists, then it is created. Existing chunks are overwritten with the provided data.

func (*DynamicChunkStore) Swap

func (store *DynamicChunkStore) Swap(factory func(oldStore chunk.Store) chunk.Store)

Swap replaces the currently wrapped store with a new one with the help of a factory function. The factory function receives the old store and must return the new instance to wrap.

type DynamicObjPropStore

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

DynamicObjPropStore wraps a object properties store instance that can be replaced during runtime. Access to the underlying store is synchronized.

func NewDynamicObjPropStore

func NewDynamicObjPropStore(wrapped objprop.Store) *DynamicObjPropStore

NewDynamicObjPropStore returns a new instance of a DynamicObjPropStore wrapping the given store

func (*DynamicObjPropStore) Get

Get returns the data for the requested ObjectID.

func (*DynamicObjPropStore) Put

func (store *DynamicObjPropStore) Put(id res.ObjectID, data objprop.ObjectData)

Put takes the provided data and associates it with the given ID, overwriting the previous data.

func (*DynamicObjPropStore) Swap

func (store *DynamicObjPropStore) Swap(factory func(oldStore objprop.Store) objprop.Store)

Swap replaces the currently wrapped store with a new one with the help of a factory function. The factory function receives the old store and must return the new instance to wrap.

type DynamicTextPropStore

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

DynamicTextPropStore wraps a object properties store instance that can be replaced during runtime. Access to the underlying store is synchronized.

func NewDynamicTextPropStore

func NewDynamicTextPropStore(wrapped textprop.Store) *DynamicTextPropStore

NewDynamicTextPropStore returns a new instance of a DynamicTextPropStore wrapping the given store

func (*DynamicTextPropStore) EntryCount

func (store *DynamicTextPropStore) EntryCount() uint32

EntryCount returns the number of currently stored properties.

func (*DynamicTextPropStore) Get

func (store *DynamicTextPropStore) Get(id uint32) []byte

Get returns the data for the requested id.

func (*DynamicTextPropStore) Put

func (store *DynamicTextPropStore) Put(id uint32, data []byte)

Put takes the provided data and associates it with the given ID, overwriting the previous data.

func (*DynamicTextPropStore) Swap

func (store *DynamicTextPropStore) Swap(factory func(oldStore textprop.Store) textprop.Store)

Swap replaces the currently wrapped store with a new one with the help of a factory function. The factory function receives the old store and must return the new instance to wrap.

type ReleaseStoreLibrary

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

ReleaseStoreLibrary is a container with two releases: one source and one sink. Stores can be retrieved from this library, which access the source release for reading properties and the sink release for writing modified data.

func (*ReleaseStoreLibrary) ChunkStore

func (library *ReleaseStoreLibrary) ChunkStore(name string) (chunkStore *DynamicChunkStore, err error)

ChunkStore implements the StoreLibrary interface.

func (*ReleaseStoreLibrary) ObjpropStore

func (library *ReleaseStoreLibrary) ObjpropStore(name string) (objpropStore objprop.Store, err error)

ObjpropStore implements the StoreLibrary interface.

func (*ReleaseStoreLibrary) SaveAll

func (library *ReleaseStoreLibrary) SaveAll()

SaveAll requests all stores to save their current state to disk. This operation is performed asynchronously.

func (*ReleaseStoreLibrary) TextpropStore

func (library *ReleaseStoreLibrary) TextpropStore(name string) (textpropStore textprop.Store, err error)

TextpropStore implements the StoreLibrary interface.

type StoreLibrary

type StoreLibrary interface {
	// SaveAll requests to persist all pending modifications.
	SaveAll()

	// ChunkStore returns a chunk store for given name.
	ChunkStore(name string) (*DynamicChunkStore, error)

	// ObjpropStore returns an object properties store for given name.
	ObjpropStore(name string) (objprop.Store, error)

	// TextpropStore returns a texture properties store for given name.
	TextpropStore(name string) (textprop.Store, error)
}

StoreLibrary wraps the methods to contain stores for various data

func NewReleaseStoreLibrary

func NewReleaseStoreLibrary(source release.Release, sink release.Release, timeoutMSec int) StoreLibrary

NewReleaseStoreLibrary returns a StoreLibrary that covers two Release container. Stores are first tried from the sink, then from source; They are saved in the sink.

Jump to

Keyboard shortcuts

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