carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package hostwrite
2
3import "context"
4
5// Selection carries the original work and rendered inputs across a callback.
6// The receiver uses With at its final local effect, never a new hostname lookup.
7// Network waits belong outside With; remote effects need a provider that binds
8// the request to this selection and refuses a successor at publication.
9type Selection struct {
10 Host string
11 Work Work
12 Identity Identity
13}
14
15func (s Selection) With(ctx context.Context, effect func() error) error {
16 if ctx == nil || s.Host == "" || s.Work == nil || effect == nil {
17 return ErrUnavailable
18 }
19 return s.Work.With(ctx, s.Identity, effect)
20}
21
22type Callback func(context.Context, Selection) error
23