types

package
v0.0.0-...-7378411 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: MIT 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(result interface{}) error

type Documents

type Documents []Document

func (Documents) Decode

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

func (*Documents) Encode

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

type GetServerFunc

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

type MsgHeader

type MsgHeader struct {
	TxnID     string
	RequestID string
	OPCode    OPCode
}

type OPABORT

type OPABORT struct {
	MsgHeader
}

type OPCOMMIT

type OPCOMMIT struct {
	MsgHeader
}

type OPCOUNT

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

type OPCode

type OPCode uint32
const (
	OPInsert OPCode = iota + 1
	OPUpdate
	OPDelete
	OPFind
	OPFindAndModify
	OPCount
	OPStartTransaction OPCode = 666
	OPCommit           OPCode = 667
	OPAbort            OPCode = 668
)

func (OPCode) String

func (c OPCode) String() string

type OPDELETE

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

type OPFIND

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

type OPFINDANDMODIFY

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

type OPINSERT

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

type OPREPLY

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

type OPSTARTTTRANSATION

type OPSTARTTTRANSATION struct {
	MsgHeader
}

type OPUPDATE

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

type Page

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

func ParsePage

func ParsePage(origin interface{}) *Page

type ReplyHeader

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

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
	TxStatusCommited
	TxStatusAborted
	TxStatusException
)

TxStatus enumerations

Jump to

Keyboard shortcuts

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