indexer

package
v0.0.0-...-9f22567 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GreaterThan op = "GreaterThan"
	LessThan    op = "LessThan"
)
View Source
const (
	ChannelTimeOut = time.Second * 10
)

Variables

View Source
var (
	NULL_BYTE       = []byte("\x00")
	FULL_BYTE       = []byte("\xFF")
	DATA_PREFIX     = []byte("\x00d")
	INDEX_PREFIX    = []byte("\x00i")
	DB_METADATA_KEY = []byte("\xFF\x00")
)
View Source
var (
	INDEX_VERSION_1    = int64(1)
	CURRENT_DB_VERSION = INDEX_VERSION_1
)

Functions

This section is empty.

Types

type Collection

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

func (*Collection) BestIndex

func (collection *Collection) BestIndex(ctx context.Context, query Query) (*Index, error)

func (*Collection) CreateIndex

func (collection *Collection) CreateIndex(ctx context.Context, fields ...string) (*Index, error)

func (*Collection) Get

func (collection *Collection) Get(ctx context.Context, recordId []byte) (ipld.Node, error)

func (*Collection) GetProof

func (collection *Collection) GetProof(recordId []byte) (*InclusionProof, error)

func (*Collection) HasPrimaryKey

func (collection *Collection) HasPrimaryKey() bool

func (*Collection) IndexNDJSON

func (collection *Collection) IndexNDJSON(ctx context.Context, byteStream io.Reader) error

func (*Collection) Indexes

func (collection *Collection) Indexes(ctx context.Context) ([]*Index, error)

func (*Collection) Initialize

func (collection *Collection) Initialize() error

func (*Collection) Insert

func (collection *Collection) Insert(ctx context.Context, record ipld.Node) error

func (*Collection) Iterate

func (collection *Collection) Iterate(ctx context.Context) (<-chan Record, error)

func (*Collection) Search

func (collection *Collection) Search(ctx context.Context, query Query) (<-chan Record, error)

type CompareCondition

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

func (*CompareCondition) Satisfy

func (cc *CompareCondition) Satisfy(record ipld.Node) (bool, error)

type Database

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

func FromBlockStore

func FromBlockStore(blockStore blockstore.Blockstore, rootCid cid.Cid) (*Database, error)

func ImportFromFile

func ImportFromFile(source string) (*Database, error)

func Merge

func Merge(ctx context.Context, db *Database, other *Database) (*Database, error)

Merge two db in ProllyTree level, but the collection merging is not handling now.(i.e. maybe here exists the case that two collections has same name but with different primary keys)

func NewDatabaseFromBlockStore

func NewDatabaseFromBlockStore(ctx context.Context, blockStore blockstore.Blockstore) (*Database, error)

func NewMemoryDatabase

func NewMemoryDatabase() (*Database, error)

func (*Database) ApplyChanges

func (db *Database) ApplyChanges(ctx context.Context) error

func (*Database) Collection

func (db *Database) Collection(name string, primaryKey ...string) (*Collection, error)

func (*Database) ExportProof

func (db *Database) ExportProof(ctx context.Context, prfCid cid.Cid, destination string) error

func (*Database) ExportToFile

func (db *Database) ExportToFile(ctx context.Context, destination string) error

func (*Database) GetBlockstore

func (db *Database) GetBlockstore() *blockstore.Blockstore

func (*Database) GetDBMetaInfo

func (db *Database) GetDBMetaInfo() (*schema.DBMetaInfo, error)

func (*Database) RootCid

func (db *Database) RootCid() cid.Cid

type InclusionProof

type InclusionProof struct {
	Key   []byte
	Proof tree.Proof
	Root  cid.Cid
}

type Index

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

func (*Index) Exists

func (index *Index) Exists() bool

func (*Index) Fields

func (index *Index) Fields() []string

func (*Index) Rebuild

func (index *Index) Rebuild(ctx context.Context) error

type Query

type Query struct {
	Equal   map[string]ipld.Node
	Compare *CompareCondition
	Sort    string
	Limit   int
	Skip    int
}

func (Query) Matches

func (query Query) Matches(record Record) bool

type Record

type Record struct {
	Id   []byte
	Data ipld.Node
}

func (*Record) AsIPLD

func (record *Record) AsIPLD() (ipld.Node, error)

func (*Record) AsIPLDWithProof

func (record *Record) AsIPLDWithProof(proof tree.Proof) (ipld.Node, error)

Jump to

Keyboard shortcuts

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