client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetaServiceClient

func NewMetaServiceClient(ctx context.Context, Addr string) (proto.MetaServiceClient, error)

Types

type Client

type Client interface {
	Close() error
	//streamServer
	AddStreamServer(ctx context.Context, StreamServerID int64, addr string) error

	//stream
	GetOrCreateStreamInfoItem(ctx context.Context, name string) (item *store.StreamInfoItem, err error)
	CreateStreamInfoItem(ctx context.Context, name string) (item *store.StreamInfoItem, err error)
	GetStreamInfoItem(ctx context.Context, name string) (item *store.StreamInfoItem, err error)
	GetStreamStat(ctx context.Context, item *store.StreamInfoItem) (begin int64, end int64, err error)
	SetStreamReadOffset(ctx context.Context, sessionID int64, offset int64, item *store.StreamInfoItem) error

	CreateSessionAndReader(ctx context.Context,
		sessionID int64, streamInfo *store.StreamInfoItem) (StreamSession, StreamReader, error)

	//session
	NewStreamSession(ctx context.Context, sessionID int64, streamInfo *store.StreamInfoItem) (StreamSession, error)

	//MQTT
	GetOrCreateMQTTSession(ctx context.Context, clientIdentifier string) (*store.MQTTSessionItem, bool, error)
	UpdateMQTTClientSession(ctx context.Context, clientIdentifier string, Unsubscribe []string, subscribe map[string]int32) error
	DeleteMQTTClientSession(ctx context.Context, clientIdentifier string) (*store.MQTTSessionItem, error)
}

func NewClient

func NewClient(sc proto.MetaServiceClient) Client

type StreamReader

type StreamReader interface {
	io.ReadSeeker
	io.Closer
	Offset() int64
}

type StreamSession

type StreamSession interface {
	NewReader() (StreamReader, error)
	NewWriter() (StreamWriter, error)
	SetReadOffset(offset int64) error
	SetReadOffsetWithCb(offset int64, f func(err error))
	GetReadOffset() (offset int64, err error)
}

type StreamWriter

type StreamWriter interface {
	io.WriteCloser
	Flush() error
	WriteWithCb(data []byte, callback func(err error))
	StreamID() int64
}

Jump to

Keyboard shortcuts

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