types

package
v0.0.0-...-be0592b Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandRDBOperation              = "RDB"
	CommandWatchTransactionOperation = "WatchTransaction"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document map[string]interface{}

func (Document) Decode

func (d Document) Decode(result interface{}) error

func (*Document) Encode

func (d *Document) Encode(value interface{}) error

type Documents

type Documents []Document

func (Documents) Decode

func (d Documents) Decode(result interface{}) error

func (*Documents) Encode

func (d *Documents) Encode(value interface{}) error

type GetServerFunc

type GetServerFunc func() ([]string, error)

type MsgHeader

type MsgHeader struct {
	OPCode    OPCode
	TxnID     string
	RequestID string
}

MsgHeader message header

type OPAbortOperation

type OPAbortOperation struct {
	MsgHeader
}

OPAbortOperation abort operation request structure

type OPAggregateOperation

type OPAggregateOperation struct {
	MsgHeader            // 标准报文头
	Collection string    // "dbname.collectionname"
	Pipiline   Documents // 要插入集合的文档
}

OPPipelineOperation insert operation request structure

type OPCode

type OPCode uint32

OPCode operation code type

const (
	// OPInsertCode insert operation code
	OPInsertCode OPCode = iota + 1
	// OPUpdateCode update operation code
	OPUpdateCode
	// OPDeleteCode delete operation code
	OPDeleteCode
	// OPFindCode query operation code
	OPFindCode
	// OPFindAndModifyCode find and modify operation code
	OPFindAndModifyCode
	// OPCountCode count operation code
	OPCountCode
	// OPAggregateCode aggregate operation code
	OPAggregateCode
	// OPStartTransactionCode start a transaction code
	OPStartTransactionCode OPCode = 666
	// OPCommitCode transaction commit operation code
	OPCommitCode OPCode = 667
	// OPAbortCode transaction abort operation code
	OPAbortCode OPCode = 668
)

func (OPCode) String

func (c OPCode) String() string

type OPCommitOperation

type OPCommitOperation struct {
	MsgHeader
}

OPCommitOperation commit operation request structure

type OPCountOperation

type OPCountOperation struct {
	MsgHeader           // 标准报文头
	Collection string   // "dbname.collectionname"
	Selector   Document // 文档查询条件
}

OPCountOperation count operation request structure

type OPDeleteOperation

type OPDeleteOperation struct {
	MsgHeader           // 标准报文头
	Collection string   // "dbname.collectionname"
	Selector   Document // 文档查询条件
}

OPDeleteOperation delete operation request structure

type OPFindAndModifyOperation

type OPFindAndModifyOperation struct {
	MsgHeader           // 标准报文头
	Collection string   // "dbname.collectionname"
	DOC        Document // 指定要执行的更新
	Selector   Document // 文档查询条件
	Upsert     bool
	Remove     bool
	ReturnNew  bool
}

OPFindAndModifyOperation find and modify operation request structure

type OPFindOperation

type OPFindOperation struct {
	MsgHeader           // 标准报文头
	Collection string   // "dbname.collectionname"
	Projection Document // ""
	Selector   Document // 文档查询条件
	Start      uint64   // start index
	Limit      uint64   // limit index
	Sort       string   // sort string
}

OPFindOperation find operation request structure

type OPInsertOperation

type OPInsertOperation struct {
	MsgHeader            // 标准报文头
	Collection string    // "dbname.collectionname"
	DOCS       Documents // 要插入集合的文档
}

OPInsertOperation insert operation request structure

type OPReply

type OPReply struct {
	ReplyHeader           // 标准报文头
	Count       uint64    // 文档查询结果数
	Docs        Documents // 文档查询结果
}

OPReply the operation reply message header structure

type OPStartTransactionOperation

type OPStartTransactionOperation struct {
	MsgHeader
}

OPStartTransactionOperation transaction request structure

type OPUpdateOperation

type OPUpdateOperation struct {
	MsgHeader           // 标准报文头
	Collection string   // "dbname.collectionname"
	DOC        Document // 指定要执行的更新
	Selector   Document // 文档查询条件
}

OPUpdateOperation update operation request structure

type Page

type Page struct {
	Limit uint64 `json:"limit,omitempty" bson:"limit,omitempty"`
	Start uint64 `json:"start,omitempty" bson:"start,omitempty"`
	Sort  string `json:"sort,omitempty" bson:"sort,omitempty"`
}

func ParsePage

func ParsePage(origin interface{}) *Page

type ReplyHeader

type ReplyHeader struct {
	MsgHeader
	Processor string
	Success   bool
	Code      int
	Message   string
}

ReplyHeader the rpc message header structure

type Transaction

type Transaction struct {
	TxnID      string    `bson:"bk_txn_id"`     // 事务ID,uuid
	RequestID  string    `bson:"bk_request_id"` // 请求ID,可选项
	Processor  string    `bson:"processor"`     // 处理进程号,结构为"IP:PORT-PID"用于识别事务session被存于那个TM多活实例
	Status     TxStatus  `bson:"status"`        // 事务状态,作为定时补偿判断条件,这个字段需要加索引
	CreateTime time.Time `bson:"create_time"`   // 创建时间,作为定时补偿判断条件和统计信息存在,这个字段需要加索引
	LastTime   time.Time `bson:"last_time"`     // 修改时间,作为统计信息存在
}

func (Transaction) IntoHeader

func (t Transaction) IntoHeader(header http.Header) http.Header

type TxStatus

type TxStatus int

TxStatus describe

const (
	TxStatusOnProgress TxStatus = iota + 1
	TxStatusCommitted
	TxStatusAborted
	TxStatusException
)

TxStatus enumerations

func (TxStatus) String

func (s TxStatus) String() string

Jump to

Keyboard shortcuts

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