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) Disable(pid [zkidentity.IdentitySize]byte) error
- func (a *Account) Disabled(pid [zkidentity.IdentitySize]byte) bool
- func (a *Account) Enable(pid [zkidentity.IdentitySize]byte) error
- func (a *Account) Enabled(pid [zkidentity.IdentitySize]byte) bool
- 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 ErrAlreadyOnline
- 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, cleartext bool) (string, error)
Deliver physically drops a message on disk. It returns the fullpath so that callers can pretty log deliveries.
func (*Account) Disable ¶ added in v0.4.0
func (a *Account) Disable(pid [zkidentity.IdentitySize]byte) error
func (*Account) Disabled ¶ added in v0.4.0
func (a *Account) Disabled(pid [zkidentity.IdentitySize]byte) bool
func (*Account) Enable ¶ added in v0.4.0
func (a *Account) Enable(pid [zkidentity.IdentitySize]byte) error
func (*Account) Enabled ¶ added in v0.4.0
func (a *Account) Enabled(pid [zkidentity.IdentitySize]byte) bool
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)
Offline knocks a user offline. This function must be called WITHOUT the mutex held.
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 ErrAlreadyOnline ¶ added in v0.4.0
type ErrAlreadyOnline struct {
// contains filtered or unexported fields
}
func (ErrAlreadyOnline) Error ¶ added in v0.4.0
func (e ErrAlreadyOnline) Error() string
type Notification ¶
type Notification struct { To [zkidentity.IdentitySize]byte From [zkidentity.IdentitySize]byte Received int64 // received time Payload []byte Cleartext bool // Set when payload is clear text 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!