Documentation ¶
Index ¶
- Constants
- type Account
- func (a *Account) Create(pid zkidentity.PublicIdentity, force bool) error
- func (a *Account) Delete(from [zkidentity.IdentitySize]byte, identifier string) error
- func (a *Account) Deliver(to [zkidentity.IdentitySize]byte, from [zkidentity.IdentitySize]byte, ...) (string, error)
- func (a *Account) Find(nick string) (*zkidentity.PublicIdentity, error)
- func (a *Account) Offline(who [zkidentity.IdentitySize]byte)
- func (a *Account) Online(who [zkidentity.IdentitySize]byte, ntfn chan *Notification) error
- func (a *Account) Pull(id [zkidentity.IdentitySize]byte) error
- func (a *Account) Push(id [zkidentity.IdentitySize]byte) error
- type Notification
Constants ¶
const ( CacheDir = "cache" UserIdentityFilename = "user.ini" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
Account opaque type that handles account related services.
func New ¶
New initializes an Account context. It creates the containing directory and launches the push channel handling. Note that New walks the root directory and removes stale locks. The directory walk is slow and this call may take a while to complete.
func (*Account) Create ¶
func (a *Account) Create(pid zkidentity.PublicIdentity, force bool) error
createAccount creates all directories and files associated with an account. It returns a logable and a sanitized error.
func (*Account) Delete ¶
func (a *Account) Delete(from [zkidentity.IdentitySize]byte, identifier string) error
func (*Account) Deliver ¶
func (a *Account) Deliver(to [zkidentity.IdentitySize]byte, from [zkidentity.IdentitySize]byte, payload []byte) (string, error)
Deliver physicaly drops a message on disk. It returns the fullpath so that callers can pretty log deliveries.
func (*Account) Find ¶ added in v0.2.0
func (a *Account) Find(nick string) (*zkidentity.PublicIdentity, error)
func (*Account) Offline ¶
func (a *Account) Offline(who [zkidentity.IdentitySize]byte)
func (*Account) Online ¶
func (a *Account) Online(who [zkidentity.IdentitySize]byte, ntfn chan *Notification) error
Online notifies Account that a user has become available. It reads all undelivered messages of disk and uses the Notification channel to propagate them.
func (*Account) Pull ¶ added in v0.2.0
func (a *Account) Pull(id [zkidentity.IdentitySize]byte) error
func (*Account) Push ¶ added in v0.2.0
func (a *Account) Push(id [zkidentity.IdentitySize]byte) error
type Notification ¶
type Notification struct { To [zkidentity.IdentitySize]byte From [zkidentity.IdentitySize]byte Received int64 // received time Payload []byte Identifier string Error error }
Notification contains the necessary information to notify the caller that a delivery has been made. Notifications are written opportunistically and non blocking. It is the receivers responsibility to read the channel queue quickly enough. This usually means that the channel should be created with some sane queue depth!