client

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: BSD-3-Clause Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client client

func New

func New(addrType, serverAddr string, clientNum int) *Client

New new c.client

func (*Client) Cancel

func (c *Client) Cancel(chain uint64, flag []byte) error

Cancel 取消提交,将数据回滚

func (*Client) Close

func (c *Client) Close()

Close close client

func (*Client) Commit

func (c *Client) Commit(chain uint64, flag []byte) error

Commit 提交,将数据写入磁盘,标志清除

func (*Client) Exist

func (c *Client) Exist(chain uint64, tbName, key []byte) bool

Exist 数据是否存在

func (*Client) Get

func (c *Client) Get(chain uint64, tbName, key []byte) []byte

Get 获取数据

func (*Client) GetAddress added in v1.0.4

func (c *Client) GetAddress() (addrType, address string)

GetAddress get address info

func (*Client) GetLastFlag

func (c *Client) GetLastFlag(chain uint64) []byte

GetLastFlag 获取最后一个标志

func (*Client) GetNextKey

func (c *Client) GetNextKey(chain uint64, tbName, preKey []byte) []byte

GetNextKey get next key

func (*Client) OpenFlag

func (c *Client) OpenFlag(chain uint64, flag []byte) error

OpenFlag 开启标志,标志用于记录操作,支持批量操作的回滚

func (*Client) Rollback

func (c *Client) Rollback(chain uint64, flag []byte) error

Rollback 将指定标志之后的所有操作回滚,要求当前没有开启标志

func (*Client) Set

func (c *Client) Set(chain uint64, tbName, key, value []byte) error

Set 存储数据,不携带标签,不会被回滚,tbName中的数据都别用SetWithFlag写,否则可能导致数据混乱

func (*Client) SetWithFlag

func (c *Client) SetWithFlag(chain uint64, flag, tbName, key, value []byte) error

SetWithFlag 写入数据,标志仅仅是一个标志,方便数据回滚 每个flag都有对应的historyDb文件,用于记录tbName.key的前一个标签记录位置 同时记录本标签最终设置的值,方便回滚

type FlagArgs

type FlagArgs struct {
	Chain uint64
	Flag  []byte
}

FlagArgs flag操作的参数

type GetArgs

type GetArgs struct {
	Chain  uint64
	TbName []byte
	Key    []byte
}

GetArgs Get接口的入参

type SetArgs

type SetArgs struct {
	Chain  uint64
	TbName []byte
	Key    []byte
	Value  []byte
}

SetArgs Set

type SetWithFlagArgs

type SetWithFlagArgs struct {
	Chain  uint64
	Flag   []byte
	TbName []byte
	Key    []byte
	Value  []byte
}

SetWithFlagArgs Set接口的入参

Jump to

Keyboard shortcuts

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