Commit 17306cb 1 parent 4411687 commit 17306cb Copy full SHA for 17306cb
File tree 2 files changed +29
-9
lines changed
2 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,11 @@ import (
13
13
"fmt"
14
14
"hash"
15
15
"os"
16
-
17
- "github.com/spf13/afero"
18
16
)
19
17
20
18
const (
21
19
// HashSize is the number of octets in hashes used by this package.
22
20
HashSize = sha256 .Size
23
-
24
- histPath = "/mnt/state/history"
25
21
)
26
22
27
23
// History is the history of the Coordinator.
@@ -30,13 +26,12 @@ type History struct {
30
26
hashFun func () hash.Hash
31
27
}
32
28
33
- // New creates a new History backed by the default filesystem store.
29
+ // New creates a new History backed by the configured store.
34
30
func New () (* History , error ) {
35
- osFS := afero . NewOsFs ()
36
- if err := osFS . MkdirAll ( histPath , 0o755 ); err != nil {
37
- return nil , fmt .Errorf ("creating history directory : %w" , err )
31
+ store , err := NewStore ()
32
+ if err != nil {
33
+ return nil , fmt .Errorf ("creating history store : %w" , err )
38
34
}
39
- store := NewAferoStore (& afero.Afero {Fs : afero .NewBasePathFs (osFS , histPath )})
40
35
return NewWithStore (store ), nil
41
36
}
42
37
Original file line number Diff line number Diff line change
1
+ // Copyright 2025 Edgeless Systems GmbH
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ //go:build !enterprise
5
+
6
+ package history
7
+
8
+ import (
9
+ "fmt"
10
+
11
+ "github.com/spf13/afero"
12
+ )
13
+
14
+ const (
15
+ histPath = "/mnt/state/history"
16
+ )
17
+
18
+ // NewStore creates a new AferoStore backed by the default filesystem store.
19
+ func NewStore () (* AferoStore , error ) {
20
+ osFS := afero .NewOsFs ()
21
+ if err := osFS .MkdirAll (histPath , 0o755 ); err != nil {
22
+ return nil , fmt .Errorf ("creating history directory: %w" , err )
23
+ }
24
+ return NewAferoStore (& afero.Afero {Fs : afero .NewBasePathFs (osFS , histPath )}), nil
25
+ }
You can’t perform that action at this time.
0 commit comments