protocol

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExporterInfo

type ExporterInfo struct {
	ResolverTag   string           `json:"resolver_tag"`
	Table         ExporterTable    `json:"table"`
	JoinTimestamp common.Timestamp `json:"join_timestamp"`

	QuitTimestamp common.Timestamp `json:"quit_timestamp"` // update

	StatusCode ExporterStatusCode `json:"status_code"` // update

	CurrentProgress ExporterProgress `json:"current_progress"` // update

}

ExporterInfo 保存 exporter 对应的相关元信息:resolver、progress、db table

type ExporterProgress

type ExporterProgress struct {
	CurrentN      int64  `json:"current_n"`       // 当前日志文件的读取进度
	CurrentFileID int64  `json:"current_file_id"` // 当前日志文件的 id
	CurrentDay    string `json:"current_day"`     // 当前日志文件的 day
}

type ExporterStatusCode

type ExporterStatusCode int
const (
	StatusActive ExporterStatusCode = iota
	StatusLazyQuit
	StatusDead
	StatusUnknown
)

type ExporterTable

type ExporterTable struct {
	TableNameSnapshotData string `json:"table_name_snapshot_data"`
	TableNameSnapshotSync string `json:"table_name_snapshot_sync"`
	TableNameState        string `json:"table_name_state"`
	TableNameRevision     string `json:"table_name_revision"`
	TableNameEventOrphan  string `json:"table_name_event_orphan"`
}

type MetaClearAllExporterInfoArgs

type MetaClearAllExporterInfoArgs struct {
}

type MetaClearAllExporterInfoReply

type MetaClearAllExporterInfoReply struct {
	OK     bool `json:"ok"`
	Number int  `json:"number"`
}

type MetaDeleteExporterInfoArgs

type MetaDeleteExporterInfoArgs struct {
	Key string `json:"key"`
}

type MetaDeleteExporterInfoReply

type MetaDeleteExporterInfoReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`

	Info ExporterInfo `json:"info"`
}

type MetaExporterHasJoinArgs

type MetaExporterHasJoinArgs struct {
	Key string `json:"key"`
}

type MetaExporterHasJoinReply

type MetaExporterHasJoinReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`
}

type MetaGetAllExporterInfoArgs

type MetaGetAllExporterInfoArgs struct {
}

type MetaGetAllExporterInfoReply

type MetaGetAllExporterInfoReply struct {
	OK bool `json:"ok"`

	ExporterInfo map[string]ExporterInfo `json:"exporter_info"`
}

type MetaGetExporterInfoArgs

type MetaGetExporterInfoArgs struct {
	Key string `json:"key"`
}

type MetaGetExporterInfoReply

type MetaGetExporterInfoReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`

	Info ExporterInfo `json:"info"`
}

type MetaGetExporterProgressArgs

type MetaGetExporterProgressArgs struct {
	Key string `json:"key"`
}

type MetaGetExporterProgressReply

type MetaGetExporterProgressReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`

	CurrentProgress ExporterProgress `json:"current_progress"`
}

type MetaGetExporterResolverArgs

type MetaGetExporterResolverArgs struct {
	Key string `json:"key"`
}

type MetaGetExporterResolverReply

type MetaGetExporterResolverReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`

	ResolverTag string `json:"resolver_tag"`
}

type MetaGetExporterStatusArgs

type MetaGetExporterStatusArgs struct {
	Key string `json:"key"`
}

type MetaGetExporterStatusReply

type MetaGetExporterStatusReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`

	JoinTimestamp common.Timestamp   `json:"join_timestamp"`
	QuitTimestamp common.Timestamp   `json:"quit_timestamp"` // update
	StatusCode    ExporterStatusCode `json:"status_code"`    // update
}

type MetaGetExporterTableArgs

type MetaGetExporterTableArgs struct {
	Key string `json:"key"`
}

type MetaGetExporterTableReply

type MetaGetExporterTableReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`

	Table ExporterTable `json:"table"`
}

type MetaNewExporterInfoArgs

type MetaNewExporterInfoArgs struct {
	Key  string       `json:"key"`
	Info ExporterInfo `json:"info"`
}

type MetaNewExporterInfoReply

type MetaNewExporterInfoReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`
}

type MetaUpdateExporterProgressArgs

type MetaUpdateExporterProgressArgs struct {
	Key             string           `json:"key"`
	CurrentProgress ExporterProgress `json:"current_progress"`
}

type MetaUpdateExporterProgressReply

type MetaUpdateExporterProgressReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`
}

type MetaUpdateExporterStatusArgs

type MetaUpdateExporterStatusArgs struct {
	Key        string             `json:"key"`
	StatusCode ExporterStatusCode `json:"status_code"`

	// for StatusLazyQuit
	QuitTimestamp common.Timestamp `json:"quit_timestamp"`
}

type MetaUpdateExporterStatusReply

type MetaUpdateExporterStatusReply struct {
	HasJoin bool `json:"has_join"`
	OK      bool `json:"ok"`
}

type MqClearMessageArgs

type MqClearMessageArgs struct {
	Tag string `json:"tag"`
}

MqClearMessageArgs 通过 Tag 过滤得到相关消息,清空并删除 tag

type MqClearMessageReply

type MqClearMessageReply struct {
	Number int  `json:"number"` // 清理数目
	OK     bool `json:"ok"`     // 是否清理成功
}

MqClearMessageReply 通过 Tag 过滤得到相关消息,清空并删除 tag

type MqFilterMessageArgs

type MqFilterMessageArgs struct {
	Tag string `json:"tag"`
}

MqFilterMessageArgs 通过 Tag 过滤得到一个消息,这个消息是所有 Tag 匹配的第一个消息

type MqFilterMessageReply

type MqFilterMessageReply struct {
	Message MqMessage `json:"message"`
	HasNext bool      `json:"has_next"` // 判断是否有后续消息待消费
	OK      bool      `json:"ok"`       // 是否过滤匹配成功
}

MqFilterMessageReply 通过 Tag 过滤得到一个消息,这个消息是所有 Tag 匹配的第一个消息

type MqMessage

type MqMessage struct {
	Tag string `json:"tag"`
	Msg []byte `json:"msg"` // ReceiveDataPackage
}

MqMessage MQ 中消息的结构,Tag 用于过滤消息,Msg 是消息主体

type MqPushMessageArgs

type MqPushMessageArgs struct {
	Message MqMessage `json:"message"`
}

MqPushMessageArgs 添加一个消息

type MqPushMessageReply

type MqPushMessageReply struct {
	OK bool `json:"ok"`
}

MqPushMessageReply 是否添加成功

type ReceiverDataPackage

type ReceiverDataPackage struct {
	Day         string   `json:"day"`          // 当前传送数据包裹的日期,用于排序
	LeftSeq     int64    `json:"left_seq"`     // 当前传送数据包裹的左序号,用于排序
	RightSeq    int64    `json:"right_seq"`    // 当前传送数据包裹的右序号,用于排序
	DataPackage [][]byte `json:"data_package"` // 快照序列化的 Data Package 主体 <=> Snapshot list
	EOF         bool     `json:"eof"`
}

type ReceiverDataRequest

type ReceiverDataRequest struct {
	ExporterTag     string              `json:"exporter_tag"` // 标识当前接收到的数据来自哪一个 exporter
	DataPackage     ReceiverDataPackage `json:"data_package"`
	CurrentProgress ExporterProgress    `json:"current_progress"`
}

ReceiverDataRequest POST 来自 Exporter, 用于上报原始快照数据

type ReceiverDataResponse

type ReceiverDataResponse struct {
	OK bool `json:"ok"` // data package 是否成功放入 mq
}

ReceiverDataResponse 响应,为空 由于会 retry,所以必定不会丢数据(大概率) TODO 需要测试,概率是多少,能否接受

type ReceiverJoinRequest

type ReceiverJoinRequest struct {
	ExporterTag string `json:"exporter_tag"` // 按照顺序检查该 tag,检查通过分配 resolver,失败返回错误信息
}

ReceiverJoinRequest GET exporter 加入,开启采集任务,不存在会创建

type ReceiverJoinResponse

type ReceiverJoinResponse struct {
	OK   bool         `json:"ok"`  // 是否加入成功
	Msg  string       `json:"msg"` // 开启成功时为 resolver id,失败时为错误信息
	Info ExporterInfo `json:"info"`
}

ReceiverJoinResponse 返回加入结果和相关消息

type ReceiverQueryRequest

type ReceiverQueryRequest struct {
	ExporterTag string `json:"exporter_tag"` // 按照顺序检查该 tag
}

ReceiverQueryRequest GET 查询 exporter 进度等信息,不存在不会创建

type ReceiverQueryResponse

type ReceiverQueryResponse struct {
	OK   bool         `json:"ok"`  // 是否查询成功
	Msg  string       `json:"msg"` // 查询成功时为 resolver id,失败时为错误信息,未存在或者已删除
	Info ExporterInfo `json:"info"`
}

ReceiverQueryResponse 返回查询结果和相关消息

type ReceiverQuitRequest

type ReceiverQuitRequest struct {
	ExporterTag string `json:"exporter_tag"` // 按照顺序检查该 tag,检查通过分配 resolver,失败返回错误信息
	LazyQuit    bool   `json:"lazy_quit"`    // 中止 resolver 时是否等处理完所有消息,或者直接终止清空该 tag 的消息,默认 false
}

ReceiverQuitRequest GET exporter 退出,中止采集任务,会清空 exporter 的元信息

type ReceiverQuitResponse

type ReceiverQuitResponse struct {
	OK  bool   `json:"ok"`  // 是否退出成功
	Msg string `json:"msg"` // 中止成功时为 resolver id,失败时为错误信息,未存在、已存在或者已删除
}

ReceiverQuitResponse 返回退出结果和相关消息

type ResolverShutdownArgs

type ResolverShutdownArgs struct {
	ExporterTag  string `json:"exporter_tag"`
	LazyShutdown bool   `json:"lazy_shutdown"` // 等到消费完消息后再关闭,或者直接关闭
}

ResolverShutdownArgs 根据提供的 ExporterTag 中止并删除 Resolver,要记得检查是否 exporter 已经正确关闭,否则可能造成 mq 中的 exporter 消息永远无法被消费

type ResolverShutdownReply

type ResolverShutdownReply struct {
	OK bool `json:"ok"`
}

ResolverShutdownReply 返回 ok

type ResolverStartArgs

type ResolverStartArgs struct {
	ExporterTag string `json:"exporter_tag"`
}

ResolverStartArgs 根据提供的 ExporterTag 为其分配一个 Resolver

type ResolverStartReply

type ResolverStartReply struct {
	ResolverTag string `json:"resolver_tag"`
	OK          bool   `json:"ok"`
}

ResolverStartReply 返回分配的 Resolver 的 Tag

Jump to

Keyboard shortcuts

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