graphstorage

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var FilenameNameDB = "names.pm"

FilenameNameDB is the filename for the name storage file

View Source
var MgsRetClose error

MgsRetClose is the return value on successful close

View Source
var MgsRetFlushAll error

MgsRetFlushAll is the return value on successful flush all

View Source
var MgsRetFlushMain error

MgsRetFlushMain is the return value on successful flush

View Source
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

func NewDiskGraphStorage(name string, readonly bool) (Storage, error)

NewDiskGraphStorage creates a new DiskGraphStorage instance.

func NewMemoryGraphStorage

func NewMemoryGraphStorage(name string) Storage

NewMemoryGraphStorage creates a new MemoryGraphStorage instance.

Jump to

Keyboard shortcuts

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