carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package rootstate
2
3import (
4 "context"
5 "os"
6)
7
8// WithRelease runs outside Work.With: release -> root host -> legacy host.
9// The caller supplies the checked private release store shared by all hosts.
10func WithRelease(ctx context.Context, store Store, effect func() error) error {
11 if store == nil || effect == nil {
12 return os.ErrPermission
13 }
14 unlock, err := store.Lock(ctx, "release.lock")
15 if err != nil {
16 return err
17 }
18 defer unlock()
19 return effect()
20}
21