store

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

README

seq 存取

原来用es存取seq, 发现seq的使用基本是根据 seq-number 去存取 seq, 更新和读取 last_seq, 没有搜索的要求, 换成可以kv存储更为合适.

分步骤实现:

  1. 操作做成接口, 修改现有实现满足接口
  2. 添加新的存储
  3. 现在是轮训数据库实现, 改成订阅last_seq更新

需求

sync 需求:

  1. 读last_seq (重启)
  2. 写last_seq (保存新的seq后)
  3. 写seq (保存seq)

convert:

  1. 读last_seq (重启,
  2. 订阅last_seq: 看seq是否更新
  3. 读seq

rpc:

  1. 获得: 读last_seq

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seq

type Seq types.BlockSeqs

Seq ...

type SeqNum

type SeqNum struct {
	// 同协议中的seq
	Number int64
	// 对应的区块高度
	Height int64
	// 从哪里获得
	From string
}

SeqNum ...

type SeqNumStore

type SeqNumStore interface {
	LastSeq() (*SeqNum, error)
	UpdateLastSeq(s db.Record) error
}

type SeqStore

type SeqStore interface {
	SaveSeqs(blockItems []db.Record) error
	GetSeq(num int64) (*block.Seq, error)
	CommitSeqAck(num int64) int64
}

SeqStore SeqStore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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