File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change
1
+ package miner
2
+
3
+ import "context"
4
+
5
+ type MinerMeta struct {
6
+ ID uint64 // minerID
7
+ }
8
+
9
+ type minerKey struct {}
10
+
11
+ // NewContext creates a new context with MinerMeta attached.
12
+ func NewContext (ctx context.Context , p * MinerMeta ) context.Context {
13
+ return context .WithValue (ctx , minerKey {}, p )
14
+ }
15
+
16
+ // FromContext returns the MinerMeta in ctx if it exists.
17
+ func FromContext (ctx context.Context ) (miner * MinerMeta , ok bool ) {
18
+ miner , ok = ctx .Value (minerKey {}).(* MinerMeta )
19
+ return
20
+ }
Original file line number Diff line number Diff line change @@ -85,8 +85,11 @@ type Store interface {
85
85
InstanceInfo (ctx context.Context ) (InstanceInfo , error )
86
86
87
87
// Get returns an io.ReadCloser object for reading the file corresponding to the resourceName from this store.
88
- // the resourceName value looks like this:
89
- // - "cache/sc-02-data-tree-r-last.dat"
88
+ // the resourceName value looks like these:
89
+ // - "cache/s-t010001-1/sc-02-data-tree-r-last-0.dat"
90
+ // - "update-cache/s-t010001-1/sc-02-data-tree-r-last-0.dat"
91
+ // - "sealed/s-t010001-101"
92
+ // - "update/s-t010001-101"
90
93
Get (ctx context.Context , resourceName string ) (io.ReadCloser , error )
91
94
// Del removes the file corresponding to given resourceName from this store
92
95
Del (ctx context.Context , resourceName string ) error
You can’t perform that action at this time.
0 commit comments