db

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableName         = "file_part"
	KeyPrefix         = TableName + "-"
	FilePartCacheTime = 5 // 5 day
)
View Source
const FilePartMapping = `` /* 180-byte string literal not displayed */

FilePartMapping 文件分片表

Variables

This section is empty.

Functions

func AddKeyPrefix

func AddKeyPrefix(hash string) string

AddKeyPrefix 添加索引前缀

func InitESDB

func InitESDB(cli db.DBCreator) error

InitESDB 创建db (插件满足接口 db.ExecConvert)

Types

type DB

type DB interface {
	Get(hash string) (*FilePart, error)
	Set(r *RecordFilePart) error
	Clean() error
}

DB operate FilePart

func NewEsDB

func NewEsDB(client db.WrapDB) DB

NewEsDB new es DB

func NewEsGrpcDB

func NewEsGrpcDB(esCli db.WrapDB, grCli types.Chain33Client) DB

NewEsGrpcDB new

func NewGRpcDB

func NewGRpcDB(client types.Chain33Client) DB

NewGRpcDB new grpc db

func NewJRpcDB

func NewJRpcDB(client *jsonclient.JSONClient) DB

NewJRpcDB new Chain json rpc db

type FilePart

type FilePart struct {
	Data       string `json:"data"`
	TxHash     string `json:"tx_hash"`
	InsertTime int64  `json:"insert_time"`
}

FilePart 文件分片

func (*FilePart) Key

func (f *FilePart) Key() string

Key 主键

func (*FilePart) RecordKey

func (f *FilePart) RecordKey() *db.IKey

RecordKey record key

type RecordFilePart

type RecordFilePart struct {
	*db.IKey
	*db.Op
	// contains filtered or unexported fields
}

RecordFilePart record

func NewRecordFilePart

func NewRecordFilePart(op int, value *FilePart) *RecordFilePart

NewRecordFilePart new RecordFilePart

func (*RecordFilePart) Value

func (r *RecordFilePart) Value() []byte

Value value

Jump to

Keyboard shortcuts

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