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: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableName = "file_summary"
	KeyPrefix = TableName + "-"
)
View Source
const FileSummaryMapping = `` /* 667-byte string literal not displayed */

FileSummaryMapping 文件汇总表

Variables

View Source
var (
	ErrInvalidOperate     = errors.New("ErrInvalidOperate")
	ErrFileBlacklisted    = errors.New("ErrFileBlacklisted")
	ErrFileNotBlacklisted = errors.New("ErrFileNotBlacklisted")
)

Functions

func AddKeyPrefix

func AddKeyPrefix(hash string) string

AddKeyPrefix 添加索引前缀

func InitESDB

func InitESDB(cli db.DBCreator) error

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

Types

type BlackFile

type BlackFile interface {
	Black(op int, hash, note string)
	Recover(op int, hash, note string)
}

func NewBlackFile

func NewBlackFile(f *FileSummary) BlackFile

type Blacklist

type Blacklist struct {
	FileBlacklistFlag bool   `json:"file_blacklist_flag"`
	FileBlacklist     string `json:"file_blacklist"`
	FileBlacklistNote string `json:"file_blacklist_note"`
}

type BlacklistInfo

type BlacklistInfo struct {
	FileHash string `json:"file_hash"`
	Note     string `json:"note"`
	Operate  int64  `json:"operate"`
}

BlacklistInfo block tx payload

type DB

type DB interface {
	Get(hash string) (*FileSummary, error)
}

DB operate FileSummary

func NewEsDB

func NewEsDB(client db.WrapDB) DB

NewEsDB new es DB

type FileInfo

type FileInfo struct {
	FileType  string `json:"file_type"`
	FileHash  string `json:"file_hash"`
	FileSize  int64  `json:"file_size"`
	PartType  int32  `json:"part_type"` // 1:base64
	PartHashs []byte `json:"part_hashs"`
}

FileInfo block tx payload

type FileSummary

type FileSummary struct {
	FileInfo
	Blacklist
	*db.Block
}

FileSummary 文件汇总

func NewSummary

func NewSummary(p FileInfo, env *db.TxEnv) *FileSummary

NewSummary new summary

func (*FileSummary) Key

func (s *FileSummary) Key() string

Key 主键

func (*FileSummary) RecordKey

func (s *FileSummary) RecordKey() *db.IKey

RecordKey 文件汇总

type RecordSummary

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

RecordSummary record

func NewRecordSummary

func NewRecordSummary(op int, value *FileSummary) *RecordSummary

NewRecordSummary new record

func (*RecordSummary) Value

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

Value value

Jump to

Keyboard shortcuts

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