transfer

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: BSD-3-Clause Imports: 7 Imported by: 3

README

Weplanx Transfer

Github Actions Coveralls github GitHub go.mod Go version Go Report Card Release GitHub license

The log transmission client is based on the push mode. Its function is to manage the log stream queues in a unified manner, to cut and buffer the log data written at high frequency, and to supplement the reliability of the non-highly available log system. It works with the same namespace. The log collection service of the log collection service writes to the log system

License

BSD-3-Clause License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	// 日志标识
	Key string `json:"key"`
	// 描述
	Description string `json:"description"`
	// 有效期
	TTL int64 `json:"ttl"`
}

type Payload

type Payload struct {
	// 元数据
	Metadata map[string]interface{} `bson:"metadata" json:"metadata"`
	// 日志
	Data map[string]interface{} `bson:"data" json:"data"`
	// 时间
	Timestamp time.Time `bson:"timestamp" json:"timestamp"`
}

type Transfer

type Transfer struct {
	Namespace string
	Db        *mongo.Database
	JetStream nats.JetStreamContext
	KeyValue  nats.KeyValue
}

func New

func New(namespace string, db *mongo.Database, js nats.JetStreamContext) (x *Transfer, err error)

New 新建传输

func (*Transfer) Get

func (x *Transfer) Get(key string) (result map[string]interface{}, err error)

Get 获取日志流传输信息,JetStream 状态

func (*Transfer) Publish

func (x *Transfer) Publish(ctx context.Context, key string, payload Payload) (err error)

Publish 发布

func (*Transfer) Remove

func (x *Transfer) Remove(key string) (err error)

Remove 移除日志流传输

func (*Transfer) Set

func (x *Transfer) Set(ctx context.Context, option Option) (err error)

Set 设置日志流传输

Jump to

Keyboard shortcuts

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