kumoi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

func (*Channel) Close

func (c *Channel) Close() SendFuture[*messages.CloseChannel]

func (*Channel) Count

func (c *Channel) Count() SendFuture[*messages.ChannelCount]

func (*Channel) Fetch

func (*Channel) Id

func (c *Channel) Id() string

func (*Channel) Info

func (c *Channel) Info() *ChannelInfo

func (*Channel) Leave

func (c *Channel) Leave() SendFuture[*messages.LeaveChannel]

func (*Channel) Metadata

func (c *Channel) Metadata() map[string]any

func (*Channel) Name

func (c *Channel) Name() string

func (*Channel) OnClose

func (c *Channel) OnClose(f func()) *Channel

func (*Channel) OnLeave

func (c *Channel) OnLeave(f func()) *Channel

func (*Channel) ReplayChannelMessage

func (c *Channel) ReplayChannelMessage(targetTimestamp int64, inverse bool, volume omega.Volume) Player

func (*Channel) Role

func (c *Channel) Role() omega.Role

func (*Channel) RoleName

func (c *Channel) RoleName() string

func (*Channel) SendMessage

func (c *Channel) SendMessage(msg string, metadata map[string]any) SendFuture[*messages.ChannelMessage]

func (*Channel) SendOwnerMessage

func (c *Channel) SendOwnerMessage(msg string, metadata map[string]any) SendFuture[*messages.ChannelOwnerMessage]

func (*Channel) SetMetadata

func (c *Channel) SetMetadata(metadata map[string]any) SendFuture[*messages.SetChannelMeta]

func (*Channel) SetName

func (c *Channel) SetName(name string) SendFuture[*messages.SetChannelMeta]

func (*Channel) SetSkill

func (c *Channel) SetSkill(skill *omega.Skill) SendFuture[*messages.SetChannelMeta]

func (*Channel) Watch

func (c *Channel) Watch(f func(msg messages.TransitFrame)) *Channel

type ChannelInfo

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

func (*ChannelInfo) ChannelId

func (c *ChannelInfo) ChannelId() string

func (*ChannelInfo) Close

func (*ChannelInfo) CreatedAt

func (c *ChannelInfo) CreatedAt() int64

func (*ChannelInfo) Join

func (c *ChannelInfo) Join(key string) *Channel

func (*ChannelInfo) Metadata

func (c *ChannelInfo) Metadata() map[string]any

func (*ChannelInfo) Name

func (c *ChannelInfo) Name() string

func (*ChannelInfo) Skill

func (c *ChannelInfo) Skill() *omega.Skill

type CreateChannelFuture

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

func (*CreateChannelFuture) Info

func (f *CreateChannelFuture) Info() *ChannelInfo

func (*CreateChannelFuture) Join

func (f *CreateChannelFuture) Join() *Channel

type CreateVoteFuture

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

func (*CreateVoteFuture) Info

func (f *CreateVoteFuture) Info() *VoteInfo

func (*CreateVoteFuture) Join

func (f *CreateVoteFuture) Join() *Vote

type Omega

type Omega struct {
	OnMessageHandler        func(msg messages.TransitFrame)
	OnSessionMessageHandler func(msg *messages.SessionMessage)
	OnBroadcastHandler      func(msg *messages.Broadcast)
	OnClosedHandler         func()
	OnErrorHandler          func(err error)
	// contains filtered or unexported fields
}

func NewOmega

func NewOmega(agent base.Agent) *Omega

func (*Omega) Agent

func (o *Omega) Agent() base.Agent

func (*Omega) Broadcast

func (o *Omega) Broadcast(msg string) bool

func (*Omega) Channel

func (o *Omega) Channel(channelId string) *ChannelInfo

func (*Omega) Close

func (o *Omega) Close() concurrent.Future

func (*Omega) CreateChannel

func (o *Omega) CreateChannel(createChannel apirequest.CreateChannel) *CreateChannelFuture

func (*Omega) CreateVote

func (o *Omega) CreateVote(createVote apirequest.CreateVote) *CreateVoteFuture

func (*Omega) GetRemoteSession

func (o *Omega) GetRemoteSession(sessionId string) RemoteSession[base.RemoteSession]

func (*Omega) Hello

func (o *Omega) Hello() SendFuture[*messages.Hello]

func (*Omega) IsClosed

func (o *Omega) IsClosed() bool

IsClosed omega is closed or not

func (*Omega) Ping

func (o *Omega) Ping() bool

func (*Omega) PlaybackChannelMessage

func (o *Omega) PlaybackChannelMessage(channelId string, targetTimestamp int64, inverse bool, volume omega.Volume) Player

func (*Omega) ServerTime

func (o *Omega) ServerTime() SendFuture[*messages.ServerTime]

func (*Omega) Session

func (o *Omega) Session() Session

func (*Omega) Vote

func (o *Omega) Vote(voteId string) *VoteInfo

type OmegaBuilder

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

func NewOmegaBuilder

func NewOmegaBuilder(conf *base.Config) *OmegaBuilder

func (*OmegaBuilder) Connect

func (b *OmegaBuilder) Connect() concurrent.CastFuture[*Omega]

func (*OmegaBuilder) WithEngine added in v1.0.2

func (b *OmegaBuilder) WithEngine(engine *base.Engine) *OmegaBuilder

type Player

type Player interface {
	Next() messages.TransitFrame
}

type RemoteSession

type RemoteSession[T base.RemoteSession] interface {
	Base() T
	GetId() string
	GetSubject() string
	GetName() string
	GetMetadata() map[string]any
	OnMessage(f func(msg *messages.SessionMessage))
	SendMessage(message string) SendFuture[*messages.SessionMessage]
	Fetch() SendFuture[*messages.GetSessionMeta]
}

type SendFuture

type SendFuture[T messages.TransitFrame] interface {
	Base() base.SendFuture
	Await() SendFuture[T]
	AwaitTimeout(timeout time.Duration) SendFuture[T]
	IsDone() bool
	IsSuccess() bool
	IsCancelled() bool
	IsFail() bool
	Error() error
	TransitFrame() (t T)
	AddListener(listener concurrent.FutureListener) SendFuture[T]
}

type Session

type Session interface {
	RemoteSession[base.Session]
	SetName(name string) SendFuture[*messages.SetSessionMeta]
	SetMetadata(metadata map[string]any) SendFuture[*messages.SetSessionMeta]
	OnRead(f func(th *omega.TransitFrame))
	OnClosed(f func())
	OnError(f func(err error))
	Close() concurrent.Future
}

type Vote

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

func (*Vote) Close

func (v *Vote) Close() SendFuture[*messages.CloseVote]

func (*Vote) Count

func (v *Vote) Count() SendFuture[*messages.VoteCount]

func (*Vote) Fetch

func (v *Vote) Fetch() SendFuture[*messages.GetVoteMeta]

func (*Vote) Id

func (v *Vote) Id() string

func (*Vote) Info

func (v *Vote) Info() *VoteInfo

func (*Vote) Leave

func (v *Vote) Leave() SendFuture[*messages.LeaveVote]

func (*Vote) Metadata

func (v *Vote) Metadata() map[string]any

func (*Vote) Name

func (v *Vote) Name() string

func (*Vote) OnClose

func (v *Vote) OnClose(f func()) *Vote

func (*Vote) OnLeave

func (v *Vote) OnLeave(f func()) *Vote

func (*Vote) Select

func (v *Vote) Select(voteOptionId string) bool

func (*Vote) SendMessage

func (v *Vote) SendMessage(msg string) SendFuture[*messages.VoteMessage]

func (*Vote) SendOwnerMessage

func (v *Vote) SendOwnerMessage(msg string) SendFuture[*messages.VoteOwnerMessage]

func (*Vote) SetMetadata

func (v *Vote) SetMetadata(metadata map[string]any) SendFuture[*messages.SetVoteMeta]

func (*Vote) SetName

func (v *Vote) SetName(name string) SendFuture[*messages.SetVoteMeta]

func (*Vote) Status

func (v *Vote) Status(statusType omega.Vote_Status) SendFuture[*messages.VoteStatus]

func (*Vote) Watch

func (v *Vote) Watch(f func(msg messages.TransitFrame)) *Vote

type VoteInfo

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

func (*VoteInfo) Close

func (v *VoteInfo) Close(key string) SendFuture[*messages.CloseVote]

func (*VoteInfo) CreatedAt

func (v *VoteInfo) CreatedAt() int64

func (*VoteInfo) Join

func (v *VoteInfo) Join(key string) *Vote

func (*VoteInfo) Metadata

func (v *VoteInfo) Metadata() map[string]any

func (*VoteInfo) Name

func (v *VoteInfo) Name() string

func (*VoteInfo) VoteId

func (v *VoteInfo) VoteId() string

func (*VoteInfo) VoteOptions

func (v *VoteInfo) VoteOptions() []VoteOption

type VoteOption

type VoteOption struct {
	Id   string
	Name string
	// contains filtered or unexported fields
}

func (*VoteOption) Select

func (vo *VoteOption) Select() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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