Documentation
¶
Overview ¶
Package unicast publishes objects to overlay hosts one by one, for a deployment with no multicast plane.
On the plane a publisher submits each object once, to one facade, and the plane delivers it to every subscribed host and repairs what is lost on the way. Without the plane the publisher does that itself: a Set submits every object to each of its hosts individually, retries each host on its own, and counts the object published once Need hosts took it. A host that missed it does not receive it from the others; the application's own fill or backfill copies it across later.
A host "took" an object when it answered the submit with 200 and a STEAK for the topic. To a submitter a duplicate and a refusal look the same (an answer that admits nothing: a topic manager raises a refusal, and the engine does not return it as an error). Without a Confirm such an answer counts as taken: resending cannot change it. With a Confirm the application asks the host whether it answers the object, and only a yes counts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Confirm ¶
Confirm asks host whether it answers the object, for an answer that admitted nothing. Nil counts such an answer as taken.
type Outcome ¶
Outcome is every host's answer to one submit.
func (Outcome) Err ¶
Err is nil when the outcome is OK, and otherwise names every host that missed the object and why.
func (Outcome) Merged ¶
Merged is one answer standing for every host's: the first that admitted outputs, else the first host's that answered at all, else the zero Result.
type Result ¶
type Result struct {
Host string
// Result is the host's STEAK entry when Err is nil.
Result publish.Result
// Confirmed is set when the answer admitted nothing and a lookup at
// the host answers the object.
Confirmed bool
// Err is the last failure when every try failed, or why an answer that
// admitted nothing was not confirmed.
Err error
// Tries is how many times the host was asked.
Tries int
}
Result is one host's answer to one submit.
type Set ¶
type Set struct {
// Hosts are the hosts' base URLs; each is POSTed <base>/submit.
Hosts []string
// Need is how many hosts must take an object for it to count.
Need int
// Retries are the waits between the tries of one host: a host is tried
// 1+len(Retries) times before it is counted as missed.
Retries []time.Duration
// HTTP is the client each host's facade uses; nil is publish's default.
HTTP *http.Client
// Note receives a line per host that did not take an object, and with
// Verbose a line per host that did.
Note func(format string, args ...any)
Verbose bool
// contains filtered or unexported fields
}
Set is the hosts a publisher submits to.
func (*Set) Facade ¶
Facade is a publish.Facade that sends every Submit to each of the Set's hosts (Send, with no Confirm and the Set's quorum), for code that publishes through one facade, such as producer.Trees. Below the quorum it answers 502 naming the hosts that missed; otherwise the merged answer. what names the objects in notes and tallies.
func (*Set) Send ¶
func (s *Set) Send(ctx context.Context, what, topic string, beef []byte, need int, confirm Confirm) Outcome
Send submits beef for topic to every host at once, each retried on its own, and returns every host's answer. what names the object in notes. need is the quorum for this object; zero means s.Need. confirm, when set, is asked about every host whose answer admitted nothing.