forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimelines.go
66 lines (54 loc) · 1.44 KB
/
timelines.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
package paths
import (
"www.velocidex.com/golang/velociraptor/file_store/api"
)
type TimelinePathManagerInterface interface {
Path() api.FSPathSpec
Index() api.FSPathSpec
Name() string
}
type TimelinePathManager struct {
name string
root api.FSPathSpec
}
func (self TimelinePathManager) Path() api.FSPathSpec {
return self.root
}
func (self TimelinePathManager) Name() string {
return self.name
}
func (self TimelinePathManager) Index() api.FSPathSpec {
return self.root.SetType(api.PATH_TYPE_FILESTORE_JSON_TIME_INDEX)
}
func NewTimelinePathManager(name string, root api.FSPathSpec) *TimelinePathManager {
return &TimelinePathManager{
name: name,
root: root,
}
}
// A Supertimeline is a collection of individual timelines. Create
// this path manager using a notebook path manager.
type SuperTimelinePathManager struct {
Name string
// Base directory where we store the timeline.
Root api.DSPathSpec
}
func NewSuperTimelinePathManager(
name string, root api.DSPathSpec) *SuperTimelinePathManager {
return &SuperTimelinePathManager{
Name: name,
Root: root,
}
}
func (self *SuperTimelinePathManager) Path() api.DSPathSpec {
return self.Root.AddUnsafeChild(self.Name)
}
// Add a child timeline to the super timeline.
func (self *SuperTimelinePathManager) GetChild(
child_name string) *TimelinePathManager {
return &TimelinePathManager{
name: child_name,
root: self.Root.AddUnsafeChild(self.Name, child_name).
AsFilestorePath(),
}
}