core_interface

package
v0.0.0-...-c772d2a Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDBCommand

type BlockDBCommand interface {
}

BlockDBCommand is the raw data operation applied on ledger. no additional info

type BlockDBCommandProcessor

type BlockDBCommandProcessor interface {
	Process(command BlockDBCommand) (CommandProcessResult, error) // better to be implemented in async way.

}

type BlockDBMessage

type BlockDBMessage interface {
}

BLockDBMessage is the enriched message including BlockDBCommand.

type BlockchainListener

type BlockchainListener interface{}

type BlockchainOperator

type BlockchainOperator interface {
	EnqueueSendToLedger(command BlockDBMessage) error
}

type CollectionInfoResponse

type CollectionInfoResponse struct {
	StorageSize    int32
	TotalIndexSize int32
	Count          int32
	NIndexes       int32
}

type CommandExecutor

type CommandExecutor interface{}

type CommandProcessResult

type CommandProcessResult struct {
	Hash string
	OK   bool
}

type DefaultBlockDBCommand

type DefaultBlockDBCommand struct {
}

type JsonCommandParser

type JsonCommandParser interface {
	FromJson(json string) (BlockDBCommand, error)
}

type LedgerSyncer

type LedgerSyncer interface{}

type SelectResponse

type SelectResponse struct {
	Content []bson.M
}

type StorageExecutor

type StorageExecutor interface {
	//插入的json对应对bson形式;返回插入成功后的主键id
	Insert(ctx context.Context, collectionName string, val bson.M) (string, error)
	//在collect中删除主键id为hash
	Delete(ctx context.Context, collectionName string, id string) (int64, error)
	/**
	filter:筛选条件 为空:则表示全取
	sort:排序条件 为空:则表示不排序
	limit:查找出来的数据量;为0: 则表示全部
	skip:跳过skip条文档 为0:则表示逐条取
	skip+limit:跳过skip个文档后,取limit个文档
	*/
	Select(ctx context.Context, collectionName string,
		filter bson.M, sort bson.M, limit int64, skip int64) (response SelectResponse, err error)
	//在collect中查找主键id为hash的文档
	SelectById(ctx context.Context, collectionName string, id string) (response SelectResponse, err error)
	//将filter更新为update
	Update(ctx context.Context, collectionName string, filter, update bson.M, operation string) (count int64, err error)
	//将filter更新为update
	//UpdateById(ctx context.Context, collectionName string, id string, update bson.M, operation string) (count int64, err error)
	//创建collection 返回创建失败的错误信息;成功则返回nil
	CreateCollection(ctx context.Context, collectionName string) (err error)
	//创建索引,返回创建后的索引名字
	CreateIndex(ctx context.Context, collectionName string, indexName, column string) (createdIndexName string, err error)
	//删除索引
	DropIndex(ctx context.Context, collectionName string, indexName string) (err error)
	//返回该collect对应的数据库大小、索引大小、文档个数、索引个数
	CollectionInfo(ctx context.Context, collection string) (resp CollectionInfoResponse, err error)
	//关闭连接
	Close(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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