4
4
5
5
A feature store is a service to store and version features.
6
6
7
- ### FeatureSets and FeatureStates
8
-
9
7
A Feature can either be computed on a dataset or a data stream, respectively using a batch or a stream processing pipeline.
10
8
This is due to the different life cycle and performance requirements for collecting and serving those data to end applications.
11
9
12
10
``` go
13
- // FeatureState ... a versioned set of features refered to a window over a reference time series or stream
14
- type FeatureState struct {
15
- Description string ` json:"description,omitempty"`
16
- Features []Feature ` json:"features,omitempty"`
17
- Labels map [string ]string ` json:"labels,omitempty"`
18
- }
19
-
20
11
// FeatureSet ... a versioned set of features
21
12
type FeatureSet struct {
22
13
InsertedAt time.Time ` json:"inserted_at,omitempty"`
@@ -26,9 +17,6 @@ type FeatureSet struct {
26
17
Labels map [string ]string ` json:"labels,omitempty"`
27
18
}
28
19
29
- // Version ... definition of version for a feature set
30
- type Version struct {}
31
-
32
20
// Feature ... a named variable with a data type
33
21
type Feature struct {
34
22
Name string ` json:"name,omitempty"`
@@ -44,6 +32,7 @@ type FeatureSetDAOProvider interface {
44
32
Init (*conf.DataSourceDefinition )
45
33
Create (fs *FeatureSet) error
46
34
GetById (id string ) (*FeatureSet, error )
35
+ GetByName (name string ) (*FeatureSet, error )
47
36
ListAllFeatureSets () (*[]FeatureSet, error )
48
37
CloseConnection ()
49
38
}
@@ -61,19 +50,36 @@ var availableDAOs = map[string]func() abstract.FeatureSetDAOProvider{
61
50
}
62
51
```
63
52
53
+ ## Service
54
+
64
55
As for the exposed service, the ` featurestore/service.go ` defines a basic interface to retrieve featureSets:
65
56
66
57
``` go
67
58
type Service interface {
68
59
Init (cfg *conf.Config ) *errors.RestErr
69
60
CreateFeatureSet (fs abstract.FeatureSet ) (*abstract.FeatureSet , *errors.RestErr )
70
61
GetFeatureSetByID (fsID string ) (*abstract.FeatureSet , *errors.RestErr )
62
+ GetFeatureSetByName (fsName string ) (*abstract.FeatureSet , *errors.RestErr )
71
63
ListAllFeatureSets () (*[]abstract.FeatureSet , *errors.RestErr )
72
64
}
73
65
```
74
66
67
+ This is translated to the following endpoint:
68
+
69
+
70
+ | Verb | Endpoint | Maps to |
71
+ | ---------| -----------------------------------| -------------------------------------------------------------|
72
+ | ** GET** | /healthcheck/featureset | github.com/pilillo/mastro/featurestore.Ping |
73
+ | ** GET** | /featureset/id/: featureset_id | github.com/pilillo/mastro/featurestore.GetFeatureSetByID |
74
+ | ** GET** | /featureset/name/: featureset_name | github.com/pilillo/mastro/featurestore.GetFeatureSetByName |
75
+ | ** PUT** | /featureset/ | github.com/pilillo/mastro/featurestore.CreateFeatureSet |
76
+ | ** GET** | /featureset/ | github.com/pilillo/mastro/featurestore.ListAllFeatureSets |
77
+
78
+
79
+
75
80
This is for instance how to add a new featureSet calculated in the test environment of a fictional project.
76
81
82
+
77
83
* PUT* on ` localhost:8085/featureset ` with body:
78
84
``` json
79
85
{
0 commit comments