Documentation
¶
Overview ¶
Package graphstorage contains classes which model storage objects for graph data.
There are two main storage objects: DiskGraphStorage which provides disk storage and MemoryGraphStorage which provides memory-only storage.
Index ¶
- Variables
- type DiskGraphStorage
- func (dgs *DiskGraphStorage) Close() error
- func (dgs *DiskGraphStorage) FlushAll() error
- func (dgs *DiskGraphStorage) FlushMain() error
- func (dgs *DiskGraphStorage) MainDB() map[string]string
- func (dgs *DiskGraphStorage) Name() string
- func (dgs *DiskGraphStorage) RollbackMain() error
- func (dgs *DiskGraphStorage) StorageManager(smname string, create bool) storage.Manager
- type MemoryGraphStorage
- func (mgs *MemoryGraphStorage) Close() error
- func (mgs *MemoryGraphStorage) FlushAll() error
- func (mgs *MemoryGraphStorage) FlushMain() error
- func (mgs *MemoryGraphStorage) MainDB() map[string]string
- func (mgs *MemoryGraphStorage) Name() string
- func (mgs *MemoryGraphStorage) RollbackMain() error
- func (mgs *MemoryGraphStorage) StorageManager(smname string, create bool) storage.Manager
- type Storage
Constants ¶
This section is empty.
Variables ¶
var FilenameNameDB = "names.pm"
FilenameNameDB is the filename for the name storage file
var MgsRetClose error
MgsRetClose is the return value on successful close
var MgsRetFlushAll error
MgsRetFlushAll is the return value on successful flush all
var MgsRetFlushMain error
MgsRetFlushMain is the return value on successful flush
var MgsRetRollbackMain error
MgsRetRollbackMain is the return value on successful rollback
Functions ¶
This section is empty.
Types ¶
type DiskGraphStorage ¶
type DiskGraphStorage struct {
// contains filtered or unexported fields
}
DiskGraphStorage data structure
func (*DiskGraphStorage) Close ¶
func (dgs *DiskGraphStorage) Close() error
Close closes the storage.
func (*DiskGraphStorage) FlushAll ¶
func (dgs *DiskGraphStorage) FlushAll() error
FlushAll writes all pending changes to the storage.
func (*DiskGraphStorage) FlushMain ¶
func (dgs *DiskGraphStorage) FlushMain() error
FlushMain writes the main database to the storage.
func (*DiskGraphStorage) MainDB ¶
func (dgs *DiskGraphStorage) MainDB() map[string]string
MainDB returns the main database.
func (*DiskGraphStorage) Name ¶
func (dgs *DiskGraphStorage) Name() string
Name returns the name of the DiskGraphStorage instance.
func (*DiskGraphStorage) RollbackMain ¶
func (dgs *DiskGraphStorage) RollbackMain() error
RollbackMain rollback the main database.
func (*DiskGraphStorage) StorageManager ¶
func (dgs *DiskGraphStorage) StorageManager(smname string, create bool) storage.Manager
StorageManager gets a storage manager with a certain name. A non-existing StorageManager is created automatically if the create flag is set to true.
type MemoryGraphStorage ¶
type MemoryGraphStorage struct {
// contains filtered or unexported fields
}
MemoryGraphStorage data structure
func (*MemoryGraphStorage) Close ¶
func (mgs *MemoryGraphStorage) Close() error
Close closes the storage.
func (*MemoryGraphStorage) FlushAll ¶
func (mgs *MemoryGraphStorage) FlushAll() error
FlushAll writes all pending changes to the storage.
func (*MemoryGraphStorage) FlushMain ¶
func (mgs *MemoryGraphStorage) FlushMain() error
FlushMain writes the main database to the storage.
func (*MemoryGraphStorage) MainDB ¶
func (mgs *MemoryGraphStorage) MainDB() map[string]string
MainDB returns the main database.
func (*MemoryGraphStorage) Name ¶
func (mgs *MemoryGraphStorage) Name() string
Name returns the name of the MemoryGraphStorage instance.
func (*MemoryGraphStorage) RollbackMain ¶
func (mgs *MemoryGraphStorage) RollbackMain() error
RollbackMain rollback th/e main database.
func (*MemoryGraphStorage) StorageManager ¶
func (mgs *MemoryGraphStorage) StorageManager(smname string, create bool) storage.Manager
StorageManager gets a storage manager with a certain name. A non-existing StorageManager is created automatically if the create flag is set to true.
type Storage ¶
type Storage interface { /* Name returns the name of the GraphStorage instance. */ Name() string /* MainDB returns the main database. The main database is a quick lookup map for meta data which is always kept in memory. */ MainDB() map[string]string /* RollbackMain rollback the main database. */ RollbackMain() error /* FlushMain writes the main database to the storage. */ FlushMain() error /* FlushAll writes all pending changes to the storage. */ FlushAll() error /* StorageManager gets a storage manager with a certain name. A non-existing StorageManager is not created automatically if the create flag is set to false. */ StorageManager(smname string, create bool) storage.Manager /* Close closes the storage. */ Close() error }
Storage interface models the storage backend for a graph manager.
func NewDiskGraphStorage ¶
NewDiskGraphStorage creates a new DiskGraphStorage instance.
func NewMemoryGraphStorage ¶
NewMemoryGraphStorage creates a new MemoryGraphStorage instance.