store

package
Version: 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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaDataItemType = 1 + iota
	StreamInfoItemType
	SSOffsetItemType
	StreamServerInfoItemType
	StreamServerHeartbeatItemType
	MQTTSessionItemType
)

Variables

View Source
var File_streamIO_meta_server_store_items_proto protoreflect.FileDescriptor

Functions

func MarshalItem

func MarshalItem(x Item) ([]byte, error)

func UnmarshalItem

func UnmarshalItem(data []byte) (mmdb.Item, error)

Types

type Item

type Item interface {
	mmdb.Item
	GetType() uint16
	UnmarshalBinary(data []byte) error
}

type MQTTSessionItem

type MQTTSessionItem struct {
	Qos1StreamInfo   *StreamInfoItem  `protobuf:"bytes,1,opt,name=Qos1_stream_info,json=Qos1StreamInfo,proto3" json:"Qos1_stream_info,omitempty"`
	Qos0StreamInfo   *StreamInfoItem  `protobuf:"bytes,2,opt,name=Qos0_stream_info,json=Qos0StreamInfo,proto3" json:"Qos0_stream_info,omitempty"`
	SessionId        int64            `protobuf:"varint,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	ClientIdentifier string           `protobuf:"bytes,4,opt,name=client_identifier,json=clientIdentifier,proto3" json:"client_identifier,omitempty"`
	CreateTs         int64            `protobuf:"varint,5,opt,name=create_ts,json=createTs,proto3" json:"create_ts,omitempty"`
	AccessTs         int64            `protobuf:"varint,6,opt,name=access_ts,json=accessTs,proto3" json:"access_ts,omitempty"`
	Topics           map[string]int32 `` /* 154-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*MQTTSessionItem) Clone

func (x *MQTTSessionItem) Clone() *MQTTSessionItem

func (*MQTTSessionItem) Descriptor deprecated

This method has been deprecated.
func (*MQTTSessionItem) Descriptor() ([]byte, []int)

Deprecated: Use MQTTSessionItem.ProtoReflect.Descriptor instead.

func (*MQTTSessionItem) GetAccessTs

func (x *MQTTSessionItem) GetAccessTs() int64

func (*MQTTSessionItem) GetClientIdentifier

func (x *MQTTSessionItem) GetClientIdentifier() string

func (*MQTTSessionItem) GetCreateTs

func (x *MQTTSessionItem) GetCreateTs() int64

func (*MQTTSessionItem) GetQos0StreamInfo

func (x *MQTTSessionItem) GetQos0StreamInfo() *StreamInfoItem

func (*MQTTSessionItem) GetQos1StreamInfo

func (x *MQTTSessionItem) GetQos1StreamInfo() *StreamInfoItem

func (*MQTTSessionItem) GetSessionId

func (x *MQTTSessionItem) GetSessionId() int64

func (*MQTTSessionItem) GetTopics

func (x *MQTTSessionItem) GetTopics() map[string]int32

func (*MQTTSessionItem) GetType

func (x *MQTTSessionItem) GetType() uint16

func (*MQTTSessionItem) Less

func (x *MQTTSessionItem) Less(other btree.Item) bool

func (*MQTTSessionItem) MarshalBinary

func (x *MQTTSessionItem) MarshalBinary() (data []byte, err error)

func (*MQTTSessionItem) ProtoMessage

func (*MQTTSessionItem) ProtoMessage()

func (*MQTTSessionItem) ProtoReflect

func (x *MQTTSessionItem) ProtoReflect() protoreflect.Message

func (*MQTTSessionItem) Reset

func (x *MQTTSessionItem) Reset()

func (*MQTTSessionItem) String

func (x *MQTTSessionItem) String() string

func (*MQTTSessionItem) UnmarshalBinary

func (x *MQTTSessionItem) UnmarshalBinary(data []byte) error

type MetaDataItem

type MetaDataItem struct {
	Key          int32 `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"`
	NextStreamId int64 `protobuf:"varint,2,opt,name=next_stream_id,json=nextStreamId,proto3" json:"next_stream_id,omitempty"`
	// contains filtered or unexported fields
}

func (*MetaDataItem) Descriptor deprecated

This method has been deprecated.
func (*MetaDataItem) Descriptor() ([]byte, []int)

Deprecated: Use MetaDataItem.ProtoReflect.Descriptor instead.

func (*MetaDataItem) GetKey

func (x *MetaDataItem) GetKey() int32

func (*MetaDataItem) GetNextStreamId

func (x *MetaDataItem) GetNextStreamId() int64

func (*MetaDataItem) GetType

func (x *MetaDataItem) GetType() uint16

func (*MetaDataItem) Less

func (x *MetaDataItem) Less(other btree.Item) bool

func (*MetaDataItem) MarshalBinary

func (x *MetaDataItem) MarshalBinary() (data []byte, err error)

func (*MetaDataItem) ProtoMessage

func (*MetaDataItem) ProtoMessage()

func (*MetaDataItem) ProtoReflect

func (x *MetaDataItem) ProtoReflect() protoreflect.Message

func (*MetaDataItem) Reset

func (x *MetaDataItem) Reset()

func (*MetaDataItem) String

func (x *MetaDataItem) String() string

func (*MetaDataItem) UnmarshalBinary

func (x *MetaDataItem) UnmarshalBinary(data []byte) error

type MetaServerInfoItem

type MetaServerInfoItem struct {
	Base *ServerInfoBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	// contains filtered or unexported fields
}

func (*MetaServerInfoItem) Descriptor deprecated

This method has been deprecated.
func (*MetaServerInfoItem) Descriptor() ([]byte, []int)

Deprecated: Use MetaServerInfoItem.ProtoReflect.Descriptor instead.

func (*MetaServerInfoItem) GetBase

func (x *MetaServerInfoItem) GetBase() *ServerInfoBase

func (*MetaServerInfoItem) ProtoMessage

func (*MetaServerInfoItem) ProtoMessage()

func (*MetaServerInfoItem) ProtoReflect

func (x *MetaServerInfoItem) ProtoReflect() protoreflect.Message

func (*MetaServerInfoItem) Reset

func (x *MetaServerInfoItem) Reset()

func (*MetaServerInfoItem) String

func (x *MetaServerInfoItem) String() string

type SSOffsetItem

type SSOffsetItem struct {
	SessionId int64 `protobuf:"varint,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	StreamId  int64 `protobuf:"varint,2,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
	Offset    int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

func (*SSOffsetItem) Descriptor deprecated

This method has been deprecated.
func (*SSOffsetItem) Descriptor() ([]byte, []int)

Deprecated: Use SSOffsetItem.ProtoReflect.Descriptor instead.

func (*SSOffsetItem) GetOffset

func (x *SSOffsetItem) GetOffset() int64

func (*SSOffsetItem) GetSessionId

func (x *SSOffsetItem) GetSessionId() int64

func (*SSOffsetItem) GetStreamId

func (x *SSOffsetItem) GetStreamId() int64

func (*SSOffsetItem) GetType

func (x *SSOffsetItem) GetType() uint16

func (*SSOffsetItem) Less

func (x *SSOffsetItem) Less(other btree.Item) bool

func (*SSOffsetItem) MarshalBinary

func (x *SSOffsetItem) MarshalBinary() (data []byte, err error)

func (*SSOffsetItem) ProtoMessage

func (*SSOffsetItem) ProtoMessage()

func (*SSOffsetItem) ProtoReflect

func (x *SSOffsetItem) ProtoReflect() protoreflect.Message

func (*SSOffsetItem) Reset

func (x *SSOffsetItem) Reset()

func (*SSOffsetItem) String

func (x *SSOffsetItem) String() string

func (*SSOffsetItem) UnmarshalBinary

func (x *SSOffsetItem) UnmarshalBinary(data []byte) error

type ServerInfoBase

type ServerInfoBase struct {
	Id     int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Leader bool   `protobuf:"varint,2,opt,name=leader,proto3" json:"leader,omitempty"`
	Addr   string `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

func (*ServerInfoBase) Descriptor deprecated

This method has been deprecated.
func (*ServerInfoBase) Descriptor() ([]byte, []int)

Deprecated: Use ServerInfoBase.ProtoReflect.Descriptor instead.

func (*ServerInfoBase) GetAddr

func (x *ServerInfoBase) GetAddr() string

func (*ServerInfoBase) GetId

func (x *ServerInfoBase) GetId() int64

func (*ServerInfoBase) GetLeader

func (x *ServerInfoBase) GetLeader() bool

func (*ServerInfoBase) ProtoMessage

func (*ServerInfoBase) ProtoMessage()

func (*ServerInfoBase) ProtoReflect

func (x *ServerInfoBase) ProtoReflect() protoreflect.Message

func (*ServerInfoBase) Reset

func (x *ServerInfoBase) Reset()

func (*ServerInfoBase) String

func (x *ServerInfoBase) String() string

type Store

type Store struct {
	// contains filtered or unexported fields
}

func OpenStore

func OpenStore(options mmdb.Options) *Store

func (*Store) AddStreamServer

func (store *Store) AddStreamServer(item *StreamServerInfoItem) (*StreamServerInfoItem, error)

func (*Store) CreateStream

func (store *Store) CreateStream(name string) (item *StreamInfoItem, create bool, err error)

func (*Store) DelOffset

func (store *Store) DelOffset(sessionID int64, streamID int64) (*SSOffsetItem, error)

func (*Store) DeleteMQTTClientSession

func (store *Store) DeleteMQTTClientSession(identifier string) (*MQTTSessionItem, error)

func (*Store) DeleteStreamServer

func (store *Store) DeleteStreamServer(item *StreamServerInfoItem) error

func (*Store) GetOffset

func (store *Store) GetOffset(SessionId int64, StreamId int64) (*SSOffsetItem, error)

func (*Store) GetOffsets

func (store *Store) GetOffsets() ([]*SSOffsetItem, error)

func (*Store) GetOrCreateMQTTSession

func (store *Store) GetOrCreateMQTTSession(identifier string) (*MQTTSessionItem, bool, error)

func (*Store) GetStream

func (store *Store) GetStream(name string) (*StreamInfoItem, error)

func (*Store) GetStreamServerHeartbeatItem

func (store *Store) GetStreamServerHeartbeatItem(ID int64) (*StreamServerHeartbeatItem, error)

func (*Store) GetStreamServerInfo

func (store *Store) GetStreamServerInfo(id int64) (*StreamServerInfoItem, error)

func (*Store) InsertStreamServerHeartbeatItem

func (store *Store) InsertStreamServerHeartbeatItem(item *StreamServerHeartbeatItem) error

func (*Store) ListStreamServer

func (store *Store) ListStreamServer() ([]*StreamServerInfoItem, error)

func (*Store) ListStreamServerHeartbeat

func (store *Store) ListStreamServerHeartbeat() ([]*StreamServerHeartbeatItem, error)

func (*Store) SetOffSet

func (store *Store) SetOffSet(items []*SSOffsetItem) error

func (*Store) UpdateMQTTClientSession

func (store *Store) UpdateMQTTClientSession(ClientIdentifier string,
	UnSubscribe []string, Subscribe map[string]int32) error

type StreamInfoItem

type StreamInfoItem struct {
	StreamId       int64  `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
	Name           string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	StreamServerId int64  `protobuf:"varint,3,opt,name=stream_server_id,json=streamServerId,proto3" json:"stream_server_id,omitempty"`
	// contains filtered or unexported fields
}

func NewStreamInfoItem

func NewStreamInfoItem(ID int64, name string) *StreamInfoItem

func (*StreamInfoItem) Descriptor deprecated

This method has been deprecated.
func (*StreamInfoItem) Descriptor() ([]byte, []int)

Deprecated: Use StreamInfoItem.ProtoReflect.Descriptor instead.

func (*StreamInfoItem) GetName

func (x *StreamInfoItem) GetName() string

func (*StreamInfoItem) GetStreamId

func (x *StreamInfoItem) GetStreamId() int64

func (*StreamInfoItem) GetStreamServerId

func (x *StreamInfoItem) GetStreamServerId() int64

func (*StreamInfoItem) GetType

func (x *StreamInfoItem) GetType() uint16

func (*StreamInfoItem) Less

func (x *StreamInfoItem) Less(other btree.Item) bool

func (*StreamInfoItem) MarshalBinary

func (x *StreamInfoItem) MarshalBinary() (data []byte, err error)

func (*StreamInfoItem) ProtoMessage

func (*StreamInfoItem) ProtoMessage()

func (*StreamInfoItem) ProtoReflect

func (x *StreamInfoItem) ProtoReflect() protoreflect.Message

func (*StreamInfoItem) Reset

func (x *StreamInfoItem) Reset()

func (*StreamInfoItem) String

func (x *StreamInfoItem) String() string

func (*StreamInfoItem) UnmarshalBinary

func (x *StreamInfoItem) UnmarshalBinary(data []byte) error

type StreamServerHeartbeatItem

type StreamServerHeartbeatItem struct {
	Base      *ServerInfoBase      `protobuf:"bytes,1,opt,name=Base,proto3" json:"Base,omitempty"`
	Timestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*StreamServerHeartbeatItem) Descriptor deprecated

This method has been deprecated.
func (*StreamServerHeartbeatItem) Descriptor() ([]byte, []int)

Deprecated: Use StreamServerHeartbeatItem.ProtoReflect.Descriptor instead.

func (*StreamServerHeartbeatItem) GetBase

func (*StreamServerHeartbeatItem) GetTimestamp

func (x *StreamServerHeartbeatItem) GetTimestamp() *timestamp.Timestamp

func (*StreamServerHeartbeatItem) GetType

func (x *StreamServerHeartbeatItem) GetType() uint16

func (*StreamServerHeartbeatItem) Less

func (x *StreamServerHeartbeatItem) Less(other btree.Item) bool

func (*StreamServerHeartbeatItem) MarshalBinary

func (x *StreamServerHeartbeatItem) MarshalBinary() (data []byte, err error)

func (*StreamServerHeartbeatItem) ProtoMessage

func (*StreamServerHeartbeatItem) ProtoMessage()

func (*StreamServerHeartbeatItem) ProtoReflect

func (*StreamServerHeartbeatItem) Reset

func (x *StreamServerHeartbeatItem) Reset()

func (*StreamServerHeartbeatItem) String

func (x *StreamServerHeartbeatItem) String() string

func (*StreamServerHeartbeatItem) UnmarshalBinary

func (x *StreamServerHeartbeatItem) UnmarshalBinary(data []byte) error

type StreamServerInfoItem

type StreamServerInfoItem struct {
	Base *ServerInfoBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	// contains filtered or unexported fields
}

func (*StreamServerInfoItem) Descriptor deprecated

This method has been deprecated.
func (*StreamServerInfoItem) Descriptor() ([]byte, []int)

Deprecated: Use StreamServerInfoItem.ProtoReflect.Descriptor instead.

func (*StreamServerInfoItem) GetBase

func (x *StreamServerInfoItem) GetBase() *ServerInfoBase

func (*StreamServerInfoItem) GetType

func (x *StreamServerInfoItem) GetType() uint16

func (*StreamServerInfoItem) Less

func (x *StreamServerInfoItem) Less(other btree.Item) bool

func (*StreamServerInfoItem) MarshalBinary

func (x *StreamServerInfoItem) MarshalBinary() (data []byte, err error)

func (*StreamServerInfoItem) ProtoMessage

func (*StreamServerInfoItem) ProtoMessage()

func (*StreamServerInfoItem) ProtoReflect

func (x *StreamServerInfoItem) ProtoReflect() protoreflect.Message

func (*StreamServerInfoItem) Reset

func (x *StreamServerInfoItem) Reset()

func (*StreamServerInfoItem) String

func (x *StreamServerInfoItem) String() string

func (*StreamServerInfoItem) UnmarshalBinary

func (x *StreamServerInfoItem) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL