fsm

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

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

func NewFSM

func NewFSM(id uint64, state State, commandsCh chan raft.Command, recorder audit.Recorder) *FSM

func (*FSM) Apply

func (f *FSM) Apply(b []byte) error

func (*FSM) CreateSessionMetadata

func (f *FSM) CreateSessionMetadata(ctx context.Context, id, clientID string, lwt *packet.Publish, mountpoint string) error

func (*FSM) DeleteRetainedMessage

func (f *FSM) DeleteRetainedMessage(ctx context.Context, topic []byte) error

func (*FSM) DeleteSessionMetadata

func (f *FSM) DeleteSessionMetadata(ctx context.Context, id, mountpoint string) error

func (*FSM) RetainedMessage

func (f *FSM) RetainedMessage(ctx context.Context, publish *packet.Publish) error

func (*FSM) Shutdown

func (f *FSM) Shutdown(ctx context.Context) error

func (*FSM) Subscribe

func (f *FSM) Subscribe(ctx context.Context, id string, pattern []byte, qos int32) error

func (*FSM) SubscribeFrom

func (f *FSM) SubscribeFrom(ctx context.Context, id string, peer uint64, pattern []byte, qos int32) error

func (*FSM) Unsubscribe

func (f *FSM) Unsubscribe(ctx context.Context, id string, pattern []byte) error

type PeerLost

type PeerLost struct {
	Peer                 uint64   `protobuf:"varint,1,opt,name=Peer,proto3" json:"Peer,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerLost) Descriptor

func (*PeerLost) Descriptor() ([]byte, []int)

func (*PeerLost) GetPeer

func (m *PeerLost) GetPeer() uint64

func (*PeerLost) ProtoMessage

func (*PeerLost) ProtoMessage()

func (*PeerLost) Reset

func (m *PeerLost) Reset()

func (*PeerLost) String

func (m *PeerLost) String() string

func (*PeerLost) XXX_DiscardUnknown

func (m *PeerLost) XXX_DiscardUnknown()

func (*PeerLost) XXX_Marshal

func (m *PeerLost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerLost) XXX_Merge

func (m *PeerLost) XXX_Merge(src proto.Message)

func (*PeerLost) XXX_Size

func (m *PeerLost) XXX_Size() int

func (*PeerLost) XXX_Unmarshal

func (m *PeerLost) XXX_Unmarshal(b []byte) error

type RetainedMessageDeleted

type RetainedMessageDeleted struct {
	Topic                []byte   `protobuf:"bytes,1,opt,name=Topic,proto3" json:"Topic,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RetainedMessageDeleted) Descriptor

func (*RetainedMessageDeleted) Descriptor() ([]byte, []int)

func (*RetainedMessageDeleted) GetTopic

func (m *RetainedMessageDeleted) GetTopic() []byte

func (*RetainedMessageDeleted) ProtoMessage

func (*RetainedMessageDeleted) ProtoMessage()

func (*RetainedMessageDeleted) Reset

func (m *RetainedMessageDeleted) Reset()

func (*RetainedMessageDeleted) String

func (m *RetainedMessageDeleted) String() string

func (*RetainedMessageDeleted) XXX_DiscardUnknown

func (m *RetainedMessageDeleted) XXX_DiscardUnknown()

func (*RetainedMessageDeleted) XXX_Marshal

func (m *RetainedMessageDeleted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RetainedMessageDeleted) XXX_Merge

func (m *RetainedMessageDeleted) XXX_Merge(src proto.Message)

func (*RetainedMessageDeleted) XXX_Size

func (m *RetainedMessageDeleted) XXX_Size() int

func (*RetainedMessageDeleted) XXX_Unmarshal

func (m *RetainedMessageDeleted) XXX_Unmarshal(b []byte) error

type RetainedMessageStored

type RetainedMessageStored struct {
	Publish              *packet.Publish `protobuf:"bytes,1,opt,name=Publish,proto3" json:"Publish,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*RetainedMessageStored) Descriptor

func (*RetainedMessageStored) Descriptor() ([]byte, []int)

func (*RetainedMessageStored) GetPublish

func (m *RetainedMessageStored) GetPublish() *packet.Publish

func (*RetainedMessageStored) ProtoMessage

func (*RetainedMessageStored) ProtoMessage()

func (*RetainedMessageStored) Reset

func (m *RetainedMessageStored) Reset()

func (*RetainedMessageStored) String

func (m *RetainedMessageStored) String() string

func (*RetainedMessageStored) XXX_DiscardUnknown

func (m *RetainedMessageStored) XXX_DiscardUnknown()

func (*RetainedMessageStored) XXX_Marshal

func (m *RetainedMessageStored) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RetainedMessageStored) XXX_Merge

func (m *RetainedMessageStored) XXX_Merge(src proto.Message)

func (*RetainedMessageStored) XXX_Size

func (m *RetainedMessageStored) XXX_Size() int

func (*RetainedMessageStored) XXX_Unmarshal

func (m *RetainedMessageStored) XXX_Unmarshal(b []byte) error

type SessionCreated

type SessionCreated struct {
	SessionID            string          `protobuf:"bytes,1,opt,name=SessionID,proto3" json:"SessionID,omitempty"`
	ClientID             string          `protobuf:"bytes,2,opt,name=ClientID,proto3" json:"ClientID,omitempty"`
	ConnectedAt          int64           `protobuf:"varint,3,opt,name=ConnectedAt,proto3" json:"ConnectedAt,omitempty"`
	Peer                 uint64          `protobuf:"varint,4,opt,name=Peer,proto3" json:"Peer,omitempty"`
	LWT                  *packet.Publish `protobuf:"bytes,5,opt,name=LWT,proto3" json:"LWT,omitempty"`
	MountPoint           string          `protobuf:"bytes,6,opt,name=MountPoint,proto3" json:"MountPoint,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*SessionCreated) Descriptor

func (*SessionCreated) Descriptor() ([]byte, []int)

func (*SessionCreated) GetClientID

func (m *SessionCreated) GetClientID() string

func (*SessionCreated) GetConnectedAt

func (m *SessionCreated) GetConnectedAt() int64

func (*SessionCreated) GetLWT

func (m *SessionCreated) GetLWT() *packet.Publish

func (*SessionCreated) GetMountPoint

func (m *SessionCreated) GetMountPoint() string

func (*SessionCreated) GetPeer

func (m *SessionCreated) GetPeer() uint64

func (*SessionCreated) GetSessionID

func (m *SessionCreated) GetSessionID() string

func (*SessionCreated) ProtoMessage

func (*SessionCreated) ProtoMessage()

func (*SessionCreated) Reset

func (m *SessionCreated) Reset()

func (*SessionCreated) String

func (m *SessionCreated) String() string

func (*SessionCreated) XXX_DiscardUnknown

func (m *SessionCreated) XXX_DiscardUnknown()

func (*SessionCreated) XXX_Marshal

func (m *SessionCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionCreated) XXX_Merge

func (m *SessionCreated) XXX_Merge(src proto.Message)

func (*SessionCreated) XXX_Size

func (m *SessionCreated) XXX_Size() int

func (*SessionCreated) XXX_Unmarshal

func (m *SessionCreated) XXX_Unmarshal(b []byte) error

type SessionDeleted

type SessionDeleted struct {
	SessionID            string   `protobuf:"bytes,1,opt,name=SessionID,proto3" json:"SessionID,omitempty"`
	Peer                 uint64   `protobuf:"varint,2,opt,name=Peer,proto3" json:"Peer,omitempty"`
	MountPoint           string   `protobuf:"bytes,3,opt,name=MountPoint,proto3" json:"MountPoint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SessionDeleted) Descriptor

func (*SessionDeleted) Descriptor() ([]byte, []int)

func (*SessionDeleted) GetMountPoint

func (m *SessionDeleted) GetMountPoint() string

func (*SessionDeleted) GetPeer

func (m *SessionDeleted) GetPeer() uint64

func (*SessionDeleted) GetSessionID

func (m *SessionDeleted) GetSessionID() string

func (*SessionDeleted) ProtoMessage

func (*SessionDeleted) ProtoMessage()

func (*SessionDeleted) Reset

func (m *SessionDeleted) Reset()

func (*SessionDeleted) String

func (m *SessionDeleted) String() string

func (*SessionDeleted) XXX_DiscardUnknown

func (m *SessionDeleted) XXX_DiscardUnknown()

func (*SessionDeleted) XXX_Marshal

func (m *SessionDeleted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionDeleted) XXX_Merge

func (m *SessionDeleted) XXX_Merge(src proto.Message)

func (*SessionDeleted) XXX_Size

func (m *SessionDeleted) XXX_Size() int

func (*SessionDeleted) XXX_Unmarshal

func (m *SessionDeleted) XXX_Unmarshal(b []byte) error

type State

type State interface {
	Subscribe(peer uint64, id string, pattern []byte, qos int32) error
	Unsubscribe(id string, pattern []byte) error
	RemoveSubscriptionsForPeer(peer uint64)
	RemoveSubscriptionsForSession(id string)
	RetainMessage(msg *packet.Publish) error
	DeleteRetainedMessage(topic []byte) error
	CreateSessionMetadata(id string, peer uint64, clientID string, connectedAt int64, lwt *packet.Publish, mountpoint string) error
	DeleteSessionMetadata(id string, peer uint64) error
	DeleteSessionMetadatasByPeer(peer uint64)
}

type StateTransition

type StateTransition struct {
	// Types that are valid to be assigned to Event:
	//	*StateTransition_RetainedMessageStored
	//	*StateTransition_RetainedMessageDeleted
	//	*StateTransition_SessionSubscribed
	//	*StateTransition_SessionUnsubscribed
	//	*StateTransition_PeerLost
	//	*StateTransition_SessionCreated
	//	*StateTransition_SessionDeleted
	Event                isStateTransition_Event `protobuf_oneof:"Event"`
	XXX_NoUnkeyedLiteral struct{}                `json:"-"`
	XXX_unrecognized     []byte                  `json:"-"`
	XXX_sizecache        int32                   `json:"-"`
}

func (*StateTransition) Descriptor

func (*StateTransition) Descriptor() ([]byte, []int)

func (*StateTransition) GetEvent

func (m *StateTransition) GetEvent() isStateTransition_Event

func (*StateTransition) GetPeerLost

func (m *StateTransition) GetPeerLost() *PeerLost

func (*StateTransition) GetRetainedMessageDeleted

func (m *StateTransition) GetRetainedMessageDeleted() *RetainedMessageDeleted

func (*StateTransition) GetRetainedMessageStored

func (m *StateTransition) GetRetainedMessageStored() *RetainedMessageStored

func (*StateTransition) GetSessionCreated

func (m *StateTransition) GetSessionCreated() *SessionCreated

func (*StateTransition) GetSessionDeleted

func (m *StateTransition) GetSessionDeleted() *SessionDeleted

func (*StateTransition) GetSessionSubscribed

func (m *StateTransition) GetSessionSubscribed() *SubscriptionCreated

func (*StateTransition) GetSessionUnsubscribed

func (m *StateTransition) GetSessionUnsubscribed() *SubscriptionDeleted

func (*StateTransition) ProtoMessage

func (*StateTransition) ProtoMessage()

func (*StateTransition) Reset

func (m *StateTransition) Reset()

func (*StateTransition) String

func (m *StateTransition) String() string

func (*StateTransition) XXX_DiscardUnknown

func (m *StateTransition) XXX_DiscardUnknown()

func (*StateTransition) XXX_Marshal

func (m *StateTransition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StateTransition) XXX_Merge

func (m *StateTransition) XXX_Merge(src proto.Message)

func (*StateTransition) XXX_OneofWrappers

func (*StateTransition) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*StateTransition) XXX_Size

func (m *StateTransition) XXX_Size() int

func (*StateTransition) XXX_Unmarshal

func (m *StateTransition) XXX_Unmarshal(b []byte) error

type StateTransitionSet

type StateTransitionSet struct {
	Events               []*StateTransition `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*StateTransitionSet) Descriptor

func (*StateTransitionSet) Descriptor() ([]byte, []int)

func (*StateTransitionSet) GetEvents

func (m *StateTransitionSet) GetEvents() []*StateTransition

func (*StateTransitionSet) ProtoMessage

func (*StateTransitionSet) ProtoMessage()

func (*StateTransitionSet) Reset

func (m *StateTransitionSet) Reset()

func (*StateTransitionSet) String

func (m *StateTransitionSet) String() string

func (*StateTransitionSet) XXX_DiscardUnknown

func (m *StateTransitionSet) XXX_DiscardUnknown()

func (*StateTransitionSet) XXX_Marshal

func (m *StateTransitionSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StateTransitionSet) XXX_Merge

func (m *StateTransitionSet) XXX_Merge(src proto.Message)

func (*StateTransitionSet) XXX_Size

func (m *StateTransitionSet) XXX_Size() int

func (*StateTransitionSet) XXX_Unmarshal

func (m *StateTransitionSet) XXX_Unmarshal(b []byte) error

type StateTransition_PeerLost

type StateTransition_PeerLost struct {
	PeerLost *PeerLost `protobuf:"bytes,5,opt,name=PeerLost,proto3,oneof"`
}

type StateTransition_RetainedMessageDeleted

type StateTransition_RetainedMessageDeleted struct {
	RetainedMessageDeleted *RetainedMessageDeleted `protobuf:"bytes,2,opt,name=RetainedMessageDeleted,proto3,oneof"`
}

type StateTransition_RetainedMessageStored

type StateTransition_RetainedMessageStored struct {
	RetainedMessageStored *RetainedMessageStored `protobuf:"bytes,1,opt,name=RetainedMessageStored,proto3,oneof"`
}

type StateTransition_SessionCreated

type StateTransition_SessionCreated struct {
	SessionCreated *SessionCreated `protobuf:"bytes,6,opt,name=SessionCreated,proto3,oneof"`
}

type StateTransition_SessionDeleted

type StateTransition_SessionDeleted struct {
	SessionDeleted *SessionDeleted `protobuf:"bytes,7,opt,name=SessionDeleted,proto3,oneof"`
}

type StateTransition_SessionSubscribed

type StateTransition_SessionSubscribed struct {
	SessionSubscribed *SubscriptionCreated `protobuf:"bytes,3,opt,name=SessionSubscribed,proto3,oneof"`
}

type StateTransition_SessionUnsubscribed

type StateTransition_SessionUnsubscribed struct {
	SessionUnsubscribed *SubscriptionDeleted `protobuf:"bytes,4,opt,name=SessionUnsubscribed,proto3,oneof"`
}

type SubscriptionCreated

type SubscriptionCreated struct {
	SessionID            string   `protobuf:"bytes,1,opt,name=SessionID,proto3" json:"SessionID,omitempty"`
	Peer                 uint64   `protobuf:"varint,2,opt,name=Peer,proto3" json:"Peer,omitempty"`
	Pattern              []byte   `protobuf:"bytes,3,opt,name=Pattern,proto3" json:"Pattern,omitempty"`
	Qos                  int32    `protobuf:"varint,4,opt,name=Qos,proto3" json:"Qos,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SubscriptionCreated) Descriptor

func (*SubscriptionCreated) Descriptor() ([]byte, []int)

func (*SubscriptionCreated) GetPattern

func (m *SubscriptionCreated) GetPattern() []byte

func (*SubscriptionCreated) GetPeer

func (m *SubscriptionCreated) GetPeer() uint64

func (*SubscriptionCreated) GetQos

func (m *SubscriptionCreated) GetQos() int32

func (*SubscriptionCreated) GetSessionID

func (m *SubscriptionCreated) GetSessionID() string

func (*SubscriptionCreated) ProtoMessage

func (*SubscriptionCreated) ProtoMessage()

func (*SubscriptionCreated) Reset

func (m *SubscriptionCreated) Reset()

func (*SubscriptionCreated) String

func (m *SubscriptionCreated) String() string

func (*SubscriptionCreated) XXX_DiscardUnknown

func (m *SubscriptionCreated) XXX_DiscardUnknown()

func (*SubscriptionCreated) XXX_Marshal

func (m *SubscriptionCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SubscriptionCreated) XXX_Merge

func (m *SubscriptionCreated) XXX_Merge(src proto.Message)

func (*SubscriptionCreated) XXX_Size

func (m *SubscriptionCreated) XXX_Size() int

func (*SubscriptionCreated) XXX_Unmarshal

func (m *SubscriptionCreated) XXX_Unmarshal(b []byte) error

type SubscriptionDeleted

type SubscriptionDeleted struct {
	SessionID            string   `protobuf:"bytes,1,opt,name=SessionID,proto3" json:"SessionID,omitempty"`
	Pattern              []byte   `protobuf:"bytes,2,opt,name=Pattern,proto3" json:"Pattern,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SubscriptionDeleted) Descriptor

func (*SubscriptionDeleted) Descriptor() ([]byte, []int)

func (*SubscriptionDeleted) GetPattern

func (m *SubscriptionDeleted) GetPattern() []byte

func (*SubscriptionDeleted) GetSessionID

func (m *SubscriptionDeleted) GetSessionID() string

func (*SubscriptionDeleted) ProtoMessage

func (*SubscriptionDeleted) ProtoMessage()

func (*SubscriptionDeleted) Reset

func (m *SubscriptionDeleted) Reset()

func (*SubscriptionDeleted) String

func (m *SubscriptionDeleted) String() string

func (*SubscriptionDeleted) XXX_DiscardUnknown

func (m *SubscriptionDeleted) XXX_DiscardUnknown()

func (*SubscriptionDeleted) XXX_Marshal

func (m *SubscriptionDeleted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SubscriptionDeleted) XXX_Merge

func (m *SubscriptionDeleted) XXX_Merge(src proto.Message)

func (*SubscriptionDeleted) XXX_Size

func (m *SubscriptionDeleted) XXX_Size() int

func (*SubscriptionDeleted) XXX_Unmarshal

func (m *SubscriptionDeleted) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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