client

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGetTimeout    = 60 * time.Second
	DefaultSetTimeout    = 10 * time.Minute
	DefaultWaitTimeout   = 5 * time.Minute
	DefaultStreamTimeout = 7 * 24 * time.Hour
)
View Source
const (
	DefaultLimit = db_util.DefaultLimit
	MediumLimit  = db_util.MediumLimit
	LargeLimit   = db_util.LargeLimit
	ExLargeLimit = db_util.ExLargeLimit
	HugeLimit    = db_util.HugeLimit
)
View Source
const (
	MessageNotSetErrorMessage  = "error message not set"
	MultipleEntryErrorMessage  = "error multiple entries found"
	EntryNotFoundErrorMessage  = "error entry not found"
	ResourceUnavailableMessage = "resource temporarily unavailable"
)
View Source
const (
	MaxMessageSize = 32 * 10e7
)

Variables

View Source
var (
	MultipleEntryError       = fmt.Errorf(MultipleEntryErrorMessage)
	EntryNotFoundError       = fmt.Errorf(EntryNotFoundErrorMessage)
	MessageNotSetError       = fmt.Errorf(MessageNotSetErrorMessage)
	ResourceUnavailableError = fmt.Errorf(ResourceUnavailableMessage)
)

Functions

func GenShardSource

func GenShardSource(b []byte) uint

func GenShardSource32

func GenShardSource32(b []byte) uint32

func IncrementBytes

func IncrementBytes(b []byte) []byte

func IsEntryNotFoundError

func IsEntryNotFoundError(e error) bool

func IsMessageNotSetError

func IsMessageNotSetError(err error) bool

func IsMultipleEntryError

func IsMultipleEntryError(e error) bool

func IsResourceUnavailableError

func IsResourceUnavailableError(err error) bool

Types

type Client

type Client struct {
	Messages []Message
	Topics   []Topic
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string) *Client

func (*Client) DeleteMessages

func (s *Client) DeleteMessages(topic string, uids [][]byte) error

func (*Client) Get

func (s *Client) Get(topic string, start []byte, wait bool) error

func (*Client) GetByPrefix

func (s *Client) GetByPrefix(topic string, prefix []byte) error

func (*Client) GetByPrefixes

func (s *Client) GetByPrefixes(topic string, prefixes [][]byte) error

func (*Client) GetLarge

func (s *Client) GetLarge(topic string, start []byte, wait bool, newest bool) error

func (*Client) GetLast

func (s *Client) GetLast() string

func (*Client) GetNext

func (s *Client) GetNext(topic string, start []byte, wait bool, newest bool) error

func (*Client) GetSingle

func (s *Client) GetSingle(topic string, uid []byte) error

func (*Client) GetSingleContext

func (s *Client) GetSingleContext(ctx context.Context, topic string, uid []byte) error

func (*Client) GetSpecific

func (s *Client) GetSpecific(topic string, uids [][]byte) error

func (*Client) GetTopicCount

func (s *Client) GetTopicCount(topic string, prefix []byte) (uint64, error)

func (*Client) GetTopicList

func (s *Client) GetTopicList() error

func (*Client) GetWOpts

func (s *Client) GetWOpts(opts Opts) error

func (*Client) Listen

func (s *Client) Listen(ctx context.Context, topic string, prefixes [][]byte) (chan *Message, error)

func (*Client) ListenOpts

func (s *Client) ListenOpts(opts Opts) (chan *Message, error)

func (*Client) Save

func (s *Client) Save(messages []*Message, timestamp time.Time) error

func (*Client) SaveSingle

func (s *Client) SaveSingle(message *Message, timestamp time.Time) error

func (*Client) SetConn

func (s *Client) SetConn() error

type ConnHandler

type ConnHandler struct {
	NewConn     chan HostConn
	Connections map[string]*grpc.ClientConn
}

func (*ConnHandler) Add

func (h *ConnHandler) Add(host string, conn *grpc.ClientConn)

func (*ConnHandler) Get

func (h *ConnHandler) Get(host string) *grpc.ClientConn

func (*ConnHandler) Start

func (h *ConnHandler) Start()

type HostConn

type HostConn struct {
	Host string
	Conn *grpc.ClientConn
}

type Message

type Message struct {
	Topic   string
	Uid     []byte
	Message []byte
}

func (Message) MessageHex

func (m Message) MessageHex() string

func (Message) UidHex

func (m Message) UidHex() string

type Opts

type Opts struct {
	Topic    string
	Start    []byte
	Prefixes [][]byte
	Max      uint32
	Uids     [][]byte
	Wait     bool
	Newest   bool
	Context  context.Context
	Timeout  time.Duration
}

type Topic

type Topic struct {
	Name string
	Size uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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