storage

package
v0.0.0-...-c59394f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterMetaKV models.KV

ClusterMetaKV for nodes cluster

View Source
var DefaultStorage = &Storage{}

DefaultStorage default storage

Functions

This section is empty.

Types

type Message

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

Message for message storage

func (*Message) Add

func (s *Message) Add(m *models.Message) error

Add adds a message

func (*Message) Nextn

func (s *Message) Nextn(userID int64, queueName string, currentID int64, maxMassageID int64, n int) ([]models.Message, error)

Nextn returns the next n messages after the given currentID, try MaxTryMessageCount entries after maxMassageID

func (*Message) One

func (s *Message) One(userID int64, queueName string, index int64) (string, error)

One returns a message string

type Nodes

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

Nodes for the cluster of server node

func (*Nodes) All

func (n *Nodes) All(key string) ([]string, error)

All returns the all the joined nodes

func (*Nodes) UpdateAll

func (n *Nodes) UpdateAll(key string, nodes []string) error

UpdateAll reset with the given nodes

type Queue

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

Queue stores data

func (*Queue) Add

func (s *Queue) Add(q *models.Queue) error

Add add q for userID

func (*Queue) All

func (s *Queue) All(userID int64) ([]models.Queue, error)

All returns queue map for userID

func (*Queue) ApplyMessageIDRange

func (s *Queue) ApplyMessageIDRange(userID int64, queueName string, size int) (int64, error)

ApplyMessageIDRange try to apply message id range

func (*Queue) InitMessageMaxID

func (s *Queue) InitMessageMaxID(userID int64, queueName string, id int64) error

InitMessageMaxID set queue max id, only if it havent been set

func (*Queue) MessageMaxID

func (s *Queue) MessageMaxID(userID int64, queueName string) (int64, error)

MessageMaxID get the max id for the queue

func (*Queue) One

func (s *Queue) One(userID int64, queueName string) (*models.Queue, error)

One returns a queue for the userID with the queueName

func (*Queue) Remove

func (s *Queue) Remove(userID int64, queueName string) error

Remove removes the queue with the name

type Squad

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

Squad is for squad storage

func (*Squad) Add

func (s *Squad) Add(squad models.Squad) error

Add adds a squad

func (*Squad) One

func (s *Squad) One(userID int64, queueName string, squadName string) (*models.Squad, error)

One gets a squad

func (*Squad) Update

func (s *Squad) Update(squad *models.Squad) error

Update updates a squad

type Storage

type Storage struct {
	*Nodes
	*Queue
	*Message
	*Squad
}

Storage defines storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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