-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathfeatureservice.go
More file actions
40 lines (35 loc) · 1.24 KB
/
featureservice.go
File metadata and controls
40 lines (35 loc) · 1.24 KB
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
package model
import (
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
"github.com/feast-dev/feast/go/protos/feast/core"
)
type FeatureService struct {
Name string
Project string
CreatedTimestamp *timestamppb.Timestamp
LastUpdatedTimestamp *timestamppb.Timestamp
Projections []*FeatureViewProjection
LoggingConfig *FeatureServiceLoggingConfig
}
type FeatureServiceLoggingConfig struct {
SampleRate float32
}
func NewFeatureServiceFromProto(proto *core.FeatureService) *FeatureService {
projections := make([]*FeatureViewProjection, len(proto.Spec.Features))
for index, projectionProto := range proto.Spec.Features {
projections[index] = NewFeatureViewProjectionFromProto(projectionProto)
}
var loggingConfig *FeatureServiceLoggingConfig
if proto.GetSpec().GetLoggingConfig() != nil {
loggingConfig = &FeatureServiceLoggingConfig{
SampleRate: proto.GetSpec().GetLoggingConfig().SampleRate,
}
}
return &FeatureService{Name: proto.Spec.Name,
Project: proto.Spec.Project,
CreatedTimestamp: proto.Meta.CreatedTimestamp,
LastUpdatedTimestamp: proto.Meta.LastUpdatedTimestamp,
Projections: projections,
LoggingConfig: loggingConfig,
}
}