responses

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Overview

Package responses handles waiting for and responding to received responses, including tracking the session billing and custom callback hooks when responses arrive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(id nonce.ID, ifc interface{}, b slice.Bytes) (e error)

type Pending

type Pending struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Pending) Add

func (p *Pending) Add(pr ResponseParams)

func (*Pending) Find

func (p *Pending) Find(id nonce.ID) (pr *Response)

func (*Pending) FindOlder

func (p *Pending) FindOlder(t time.Time) (r []*Response)

func (*Pending) GetOldestPending

func (p *Pending) GetOldestPending() (pr *Response)

func (*Pending) ProcessAndDelete

func (p *Pending) ProcessAndDelete(id nonce.ID, ifc interface{},
	b slice.Bytes) (found bool, e error)

ProcessAndDelete runs the callback and post accounting function list and deletes the pending response.

Returns true if it found and deleted a pending response.

type Response

type Response struct {
	ID       nonce.ID
	SentSize int
	Port     uint16
	Billable []crypto.PubBytes
	Return   crypto.PubBytes
	PostAcct []func()
	sessions.Sessions
	Callback Callback
	Time     time.Time
	Success  qu.C
}

type ResponseParams

type ResponseParams struct {
	ID       nonce.ID
	SentSize int
	S        sessions.Sessions
	Billable []crypto.PubBytes
	Ret      crypto.PubBytes
	Port     uint16
	Callback Callback
	PostAcct []func()
}

Jump to

Keyboard shortcuts

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