messages

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2015 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFetchWatcher

func AddFetchWatcher(j chan *models.JSONMessage)

func GetAddresses

func GetAddresses(r routing.Router, to *models.Address) (server *identity.Address, author *identity.Address, err error)

func InvalidateCaches

func InvalidateCaches()

func LoadContactProfile

func LoadContactProfile(
	r routing.Router,
	c *models.Contact,
	from *identity.Identity,
) error

func SendAlert

func SendAlert(r routing.Router, msgName string, from *identity.Identity, to string, serverAlias string) error

Types

type Fetcher

type Fetcher struct {
	Public  *time.Ticker
	Private *time.Ticker

	Packager *packaging.Packager

	Watchers []chan *models.JSONMessage

	Client *dap.Client
	Router routing.Router

	Tables map[string]gdb.Table
	Store  gdb.Executor
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher() *Fetcher

func (*Fetcher) ForceFetch

func (f *Fetcher) ForceFetch(since uint64)

func (*Fetcher) LoadCredentials

func (f *Fetcher) LoadCredentials(
	c *dap.Client,
	r routing.Router,
	t map[string]gdb.Table,
	s gdb.Executor,
	p *packaging.Packager,
)

func (*Fetcher) NeedsCredentials

func (f *Fetcher) NeedsCredentials() bool

func (*Fetcher) Stop

func (f *Fetcher) Stop()

type MessageManager

type MessageManager struct {
	Tables   map[string]gdb.Table
	Store    gdb.Executor
	Client   *dap.Client
	Router   routing.Router
	Identity *models.Identity
	Packager *packaging.Packager
}

func (*MessageManager) GetAllMessages

func (m *MessageManager) GetAllMessages(msgChan chan *models.JSONMessage)

func (*MessageManager) GetMessage

func (m *MessageManager) GetMessage(alias string, name string) (*models.JSONMessage, error)

func (*MessageManager) GetPrivateMessages

func (m *MessageManager) GetPrivateMessages(since uint64, withComponents []string) []*models.JSONMessage

GetPrivateMessages will return an array of JSON Messges with the given arguments.

func (*MessageManager) GetPublic

func (m *MessageManager) GetPublic(since uint64, addr *models.Address) ([]*models.JSONMessage, error)

func (*MessageManager) GetPublicMessages

func (m *MessageManager) GetPublicMessages(since uint64, withComponents []string) []*models.JSONMessage

func (*MessageManager) GetSentMessages

func (m *MessageManager) GetSentMessages(since uint64, withComponents []string) ([]*models.JSONMessage, error)

func (*MessageManager) PublishMessage

func (m *MessageManager) PublishMessage(msg *models.JSONMessage) error

type MessageStore

type MessageStore struct {
	// Store Everything, only loop over this one
	Named map[string]*MessageStoreRecord
	// Quick lookup to Public Messages
	Public map[string][]*MessageStoreRecord
	// Quick lookup to Public Messages
	Profiles map[string]*MessageStoreProfile
	// Ticker
	Ticker *time.Ticker
	// Meta
	Lock        *sync.RWMutex
	ProfileLock *sync.RWMutex
	Latest      time.Time
}

func NewMessageStore

func NewMessageStore() *MessageStore

func (*MessageStore) AddMessage

func (c *MessageStore) AddMessage(msg *models.JSONMessage, refresh updateFunc)

func (*MessageStore) AddProfile

func (c *MessageStore) AddProfile(msg *models.JSONProfile, refresh profileFunc)

func (*MessageStore) Invalidate

func (c *MessageStore) Invalidate()

func (*MessageStore) LatestMessage

func (c *MessageStore) LatestMessage() time.Time

func (*MessageStore) RetrieveAll

func (c *MessageStore) RetrieveAll() []*models.JSONMessage

func (*MessageStore) RetrieveAllPrivate

func (c *MessageStore) RetrieveAllPrivate() []*models.JSONMessage

func (*MessageStore) RetrieveAllPublic

func (c *MessageStore) RetrieveAllPublic() []*models.JSONMessage

func (*MessageStore) RetrieveMessage

func (c *MessageStore) RetrieveMessage(from string, name string) *models.JSONMessage

func (*MessageStore) RetrieveProfile

func (c *MessageStore) RetrieveProfile(forAddr string) (*models.JSONProfile, bool)

func (*MessageStore) RetrievePublic

func (c *MessageStore) RetrievePublic(from string) []*models.JSONMessage

type MessageStoreProfile

type MessageStoreProfile struct {
	*models.JSONProfile
	Expires time.Time
	Updater profileFunc
}

type MessageStoreRecord

type MessageStoreRecord struct {
	*models.JSONMessage
	Retrieved time.Time
	Expires   time.Time
	Public    bool
	Updater   updateFunc
}

Jump to

Keyboard shortcuts

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