generated from snivilised/astrolib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internal-traverse-defs.go
172 lines (144 loc) Β· 4.34 KB
/
internal-traverse-defs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package tv
import (
"io/fs"
"github.com/snivilised/traverse/core"
"github.com/snivilised/traverse/internal/enclave"
"github.com/snivilised/traverse/internal/opts"
"github.com/snivilised/traverse/internal/third/lo"
"github.com/snivilised/traverse/pref"
)
type optionHarvest struct {
o *pref.Options
binder *opts.Binder
loaded *opts.LoadInfo
}
func (a *optionHarvest) Options() *pref.Options {
return lo.TernaryF(a.loaded != nil,
func() *pref.Options {
return a.loaded.O
},
func() *pref.Options {
return a.o
},
)
}
func (a *optionHarvest) Binder() *opts.Binder {
return a.binder
}
func (a *optionHarvest) Loaded() *opts.LoadInfo {
return a.loaded
}
// optionsBuilder
type optionsBuilder interface {
build(ext extent) (enclave.OptionHarvest, error)
}
type optionBuilder func(ext extent) (enclave.OptionHarvest, error)
func (fn optionBuilder) build(ext extent) (enclave.OptionHarvest, error) {
return fn(ext)
}
// pluginsBuilder
type pluginsBuilder interface {
build(o *pref.Options,
using *pref.Using,
mediator enclave.Mediator,
kc enclave.KernelController,
others ...enclave.Plugin,
) ([]enclave.Plugin, error)
}
type activated func(*pref.Options,
*pref.Using,
enclave.Mediator,
enclave.KernelController,
...enclave.Plugin,
) ([]enclave.Plugin, error)
func (fn activated) build(o *pref.Options,
using *pref.Using,
mediator enclave.Mediator,
kc enclave.KernelController,
others ...enclave.Plugin,
) ([]enclave.Plugin, error) {
return fn(o, using, mediator, kc, others...)
}
type fsBuilder interface {
build(path string) fs.FS
}
type filesystem func(path string) fs.FS
func (fn filesystem) build(path string) fs.FS {
return fn(path)
}
type extentBuilder interface {
build(forest *core.Forest) extent
}
type extension func(forest *core.Forest) extent
func (fn extension) build(forest *core.Forest) extent {
return fn(forest)
}
// We need an entity that manages the decoration of the client handler. The
// following scenarios need to be catered for:
//
// [prime]
// - raw: handler not decorated
// - filtered: decorated by filter
// - sample: decorated by filter
// - hiber: decorated by hiber wake/sleep filter
// [resume-fastward]
// - raw: handler decorated by hiber wake/filter >>> fast forwarding
// [resume-spawn]
// - raw: handler not decorated
//
// We need something that manages the client callback, let's call this
// the guardian; it kind of replaces the agent, but has a more limited scope.
// The guardian simply manages decorations for all the scenarios we have listed
// above. And to ensure that it can't be abused, we hide it behind an interface
// and let's call that the sentinel; so the guardian is an implementation of
// the sentinel.
//
// So we have to make sure that we have a persistence object that records
// everything about the internal state
// β¨ =========================================================================
// extent
// primary resume
// ============================================================================
// sync
// sequential
//
// reactive
//
// [options builder.GetOptions]
// extent
// primary resume
// ============================================================================
// sync
// sequential from params from file
// reactive from params from file
//
// β¨ ==========================================================================
// KERNEL: mediator
// KERNEL: navigationController
// navigationImpl: navigatorBase // implFiles, implDirectories, implUniversal // agent
// FEATURE: resume hydrate (depends on FEATURE: hibernation)
// resumeController
// resumeStrategy
// FEATURE: sampling
// samplingController
// FEATURE: filter
// FEATURE: hibernation
// β° TIMELINE
// !!! keep in mind that the bootstrap must fall away after initialisation.
// Any orchestration required during navigation time is the responsibility
// of the mediator
//
// --> pre init
// * features register handler with message bus; if they can
//
// --> client invoke new
// * create driver/session
//
// --> acquire options
// * get default options
// * primary: user applies choices to the defaults
// * resume: load options from file and apply to defaults
// * announce options.available (might not be required, let's see)
//
// --> configure features (filter,sampler,hibernation,resume)
//