session

package
v0.0.0-...-fd752eb Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Nil = redis.Nil

Nil ...

Variables

View Source
var (

	// RedisObjectSeperator Object separator
	RedisObjectSeperator = ":"
	// RedisObjectPrefix Prefix
	RedisObjectPrefix = "info"
)

Functions

func Connect

func Connect() error

Connect ...

func Init

func Init(url string)

Init ...

func Ping

func Ping(ctx context.Context) error

Ping ping database

Types

type Config

type Config struct {
	URL string
}

Config ...

type CustomerRoomsInfo

type CustomerRoomsInfo struct {
	RedisSet
}

CustomerRoomsInfo ...

func NewCustomerRoomsInfo

func NewCustomerRoomsInfo(id string) *CustomerRoomsInfo

NewCustomerRoomsInfo ...

func (*CustomerRoomsInfo) Add

func (info *CustomerRoomsInfo) Add(ctx context.Context, room string) error

Add add room

func (*CustomerRoomsInfo) Count

func (info *CustomerRoomsInfo) Count(ctx context.Context, room string) (int64, error)

Count count rooms

func (*CustomerRoomsInfo) Delete

func (info *CustomerRoomsInfo) Delete(ctx context.Context, room string) error

Delete delete room

func (*CustomerRoomsInfo) GetPath

func (r *CustomerRoomsInfo) GetPath() string

GetPath ...

func (*CustomerRoomsInfo) Owns

func (info *CustomerRoomsInfo) Owns(ctx context.Context, room string) (bool, error)

Owns check if room

type Info

type Info struct {
	RedisDict
}

Info ...

func NewInfo

func NewInfo(id string) *Info

NewInfo ...

func (*Info) GetClosedAt

func (info *Info) GetClosedAt(ctx context.Context, t *time.Time) error

GetClosedAt check if peer

func (*Info) GetCreatedAt

func (info *Info) GetCreatedAt(ctx context.Context, t *time.Time) error

GetCreatedAt check if peer

func (*Info) GetPath

func (r *Info) GetPath() string

GetPath ...

func (*Info) ReOpened

func (info *Info) ReOpened(ctx context.Context) error

ReOpened check if peer

func (*Info) SetClosedAt

func (info *Info) SetClosedAt(ctx context.Context, t time.Time) error

SetClosedAt add peer

func (*Info) SetCreatedAt

func (info *Info) SetCreatedAt(ctx context.Context, t time.Time) error

SetCreatedAt add peer

func (*Info) SetPeer

func (info *Info) SetPeer(ctx context.Context, peer string) error

SetPeer ...

func (*Info) SetRoom

func (info *Info) SetRoom(ctx context.Context, room string) error

SetRoom ...

type Peer

type Peer struct {
}

Peer peer info in room

type Permission

type Permission struct {
	Publish   []string
	Subscribe []string
	Commands  []string
}

Permission peer permission

type Recording

type Recording struct {
	Enabled bool

	Location string
	// contains filtered or unexported fields
}

Recording ...

type RedisDict

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

func (*RedisDict) GetPath

func (r *RedisDict) GetPath() string

GetPath ...

type RedisList

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

func (*RedisList) GetPath

func (r *RedisList) GetPath() string

GetPath ...

type RedisSet

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

func (*RedisSet) GetPath

func (r *RedisSet) GetPath() string

GetPath ...

type Room

type Room struct {
	ID          string
	Name        string
	Description string
	CreatedAt   time.Time
	StartedAt   time.Time

	Roles []string
	// contains filtered or unexported fields
}

Room room info

type RoomPeersInfo

type RoomPeersInfo struct {
	RedisDict
}

RoomPeersInfo ...

func NewRoomPeersInfo

func NewRoomPeersInfo(id string) *RoomPeersInfo

NewRoomPeersInfo ...

func (*RoomPeersInfo) AddPeer

func (info *RoomPeersInfo) AddPeer(ctx context.Context, peer string) error

AddPeer add peer

func (*RoomPeersInfo) CountPeers

func (info *RoomPeersInfo) CountPeers(ctx context.Context) (int64, error)

CountPeers count rooms

func (*RoomPeersInfo) DeletePeer

func (info *RoomPeersInfo) DeletePeer(ctx context.Context, peer string) error

DeletePeer delete peer

func (*RoomPeersInfo) GetPath

func (r *RoomPeersInfo) GetPath() string

GetPath ...

func (*RoomPeersInfo) GetPeer

func (info *RoomPeersInfo) GetPeer(ctx context.Context, peer string, t *time.Time) error

GetPeer check if peer

type RoomsInfo

type RoomsInfo struct {
	RedisDict
	// contains filtered or unexported fields
}

RoomsInfo ...

func NewRoomsInfo

func NewRoomsInfo(id string) *RoomsInfo

NewRoomsInfo ...

func (*RoomsInfo) CountPeers

func (info *RoomsInfo) CountPeers(ctx context.Context) (int64, error)

CountPeers count rooms

func (*RoomsInfo) GetClosedAt

func (info *RoomsInfo) GetClosedAt(ctx context.Context, t *time.Time) error

GetClosedAt check if peer

func (*RoomsInfo) GetCreatedAt

func (info *RoomsInfo) GetCreatedAt(ctx context.Context, t *time.Time) error

GetCreatedAt check if peer

func (*RoomsInfo) GetOwner

func (info *RoomsInfo) GetOwner(ctx context.Context, owner *string) error

GetOwner check if owner

func (*RoomsInfo) GetPath

func (r *RoomsInfo) GetPath() string

GetPath ...

func (*RoomsInfo) SetClosedAt

func (info *RoomsInfo) SetClosedAt(ctx context.Context, t time.Time) error

SetClosedAt add peer

func (*RoomsInfo) SetCreatedAt

func (info *RoomsInfo) SetCreatedAt(ctx context.Context, t time.Time) error

SetCreatedAt add peer

func (*RoomsInfo) SetOwner

func (info *RoomsInfo) SetOwner(ctx context.Context, owner string) error

SetOwner add owner

type Session

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

Session ...

func New

func New(room, peer string) Session

New ...

func (Session) Close

func (session Session) Close(ctx context.Context) error

Close close session

func (Session) Open

func (session Session) Open(ctx context.Context) error

Open open session

func (Session) Store

func (session Session) Store(ctx context.Context)

Store store stream

type State

type State struct {
	Version int
	Active  int
	Waiting bool
	Locked  bool
	Peers   map[string]Peer
}

State RoomState

type Stream

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

Stream ...

func NewStream

func NewStream(room, peer, media string) Stream

NewStream ...

func (Stream) Close

func (stream Stream) Close(ctx context.Context) error

Close close stream

func (*Stream) Duration

func (stream *Stream) Duration(ctx context.Context) (time.Duration, error)

Duration stream duration

func (Stream) Open

func (stream Stream) Open(ctx context.Context) error

Open open stream

func (Stream) Store

func (stream Stream) Store(ctx context.Context)

Store store stream

type StreamInfo

type StreamInfo struct {
	RedisDict
}

StreamInfo ...

func NewStreamInfo

func NewStreamInfo(id string) *StreamInfo

NewSessionInfo ...

func (*StreamInfo) GetClosedAt

func (info *StreamInfo) GetClosedAt(ctx context.Context, t *time.Time) error

GetClosedAt check if peer

func (*StreamInfo) GetCreatedAt

func (info *StreamInfo) GetCreatedAt(ctx context.Context, t *time.Time) error

GetCreatedAt check if peer

func (*StreamInfo) GetPath

func (r *StreamInfo) GetPath() string

GetPath ...

func (*StreamInfo) ReOpened

func (info *StreamInfo) ReOpened(ctx context.Context) error

ReOpened check if peer

func (*StreamInfo) SetClosedAt

func (info *StreamInfo) SetClosedAt(ctx context.Context, t time.Time) error

SetClosedAt add peer

func (*StreamInfo) SetCreatedAt

func (info *StreamInfo) SetCreatedAt(ctx context.Context, t time.Time) error

SetCreatedAt add peer

func (*StreamInfo) SetMedia

func (info *StreamInfo) SetMedia(ctx context.Context, media string) error

SetMedia ...

func (*StreamInfo) SetPeer

func (info *StreamInfo) SetPeer(ctx context.Context, peer string) error

SetPeer ...

func (*StreamInfo) SetRoom

func (info *StreamInfo) SetRoom(ctx context.Context, room string) error

SetRoom ...

Jump to

Keyboard shortcuts

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