aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/store/segment.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/store/segment.go')
-rw-r--r--internal/store/segment.go27
1 files changed, 21 insertions, 6 deletions
diff --git a/internal/store/segment.go b/internal/store/segment.go
index 06849749..32c8a141 100644
--- a/internal/store/segment.go
+++ b/internal/store/segment.go
@@ -92,8 +92,14 @@ func (eh *EntryHandle) Load(v *hst.State) (hst.Enablements, error) {
if v != nil {
et, err = entryDecode(f, v)
if err == nil && v.ID != eh.ID {
- err = &hst.AppError{Step: "validate state identifier", Err: os.ErrInvalid,
- Msg: fmt.Sprintf("state entry %s has unexpected id %s", eh.ID.String(), v.ID.String())}
+ err = &hst.AppError{
+ Step: "validate state identifier",
+ Err: os.ErrInvalid,
+ Msg: fmt.Sprintf(
+ "state entry %s has unexpected id %s",
+ eh.ID.String(), v.ID.String(),
+ ),
+ }
}
} else {
et, err = entryDecodeHeader(f)
@@ -127,7 +133,10 @@ type Handle struct {
// A non-nil error returned by Lock is of type [hst.AppError].
func (h *Handle) Lock() (unlock func(), err error) {
if unlock, err = h.fileMu.Lock(); err != nil {
- return nil, &hst.AppError{Step: "acquire lock on store segment " + strconv.Itoa(h.Identity), Err: err}
+ return nil, &hst.AppError{
+ Step: "acquire lock on store segment " + strconv.Itoa(h.Identity),
+ Err: err,
+ }
}
return
}
@@ -174,8 +183,11 @@ func (h *Handle) Entries() (iter.Seq[*EntryHandle], int, error) {
// this should never happen
if ent.IsDir() {
- eh.DecodeErr = &hst.AppError{Step: step,
- Err: errors.New("unexpected directory " + strconv.Quote(ent.Name()) + " in store")}
+ eh.DecodeErr = &hst.AppError{
+ Step: step,
+ Err: errors.New("unexpected directory " +
+ strconv.Quote(ent.Name()) + " in store"),
+ }
goto out
}
@@ -186,7 +198,10 @@ func (h *Handle) Entries() (iter.Seq[*EntryHandle], int, error) {
// this either indicates a serious bug or external interference
if err := eh.ID.UnmarshalText([]byte(ent.Name())); err != nil {
- eh.DecodeErr = &hst.AppError{Step: "decode store segment entry", Err: err}
+ eh.DecodeErr = &hst.AppError{
+ Step: "decode store segment entry",
+ Err: err,
+ }
goto out
}