Skip to content

Commit

Permalink
fix: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
stillmatic committed Nov 13, 2023
1 parent 02f416a commit f1ed1ef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
16 changes: 8 additions & 8 deletions client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package featuresheet
package flagsheet

import (
"context"
Expand All @@ -9,8 +9,8 @@ import (

"github.com/Yiling-J/theine-go"
"github.com/bufbuild/connect-go"
featuresheetv1 "github.com/stillmatic/featuresheet/gen/featuresheet/v1"
"github.com/stillmatic/featuresheet/gen/featuresheet/v1/featuresheetv1connect"
flagsheetv1 "github.com/stillmatic/flagsheet/gen/flagsheet/v1"
"github.com/stillmatic/flagsheet/gen/flagsheet/v1/flagsheetv1connect"
)

type flagQuery struct {
Expand All @@ -20,18 +20,18 @@ type flagQuery struct {

type FlagClient struct {
// flags is the feature flags client
flags featuresheetv1connect.FeatureSheetServiceClient
flags flagsheetv1connect.FlagSheetServiceClient
// cache stores key value pairs with their result
cache *theine.Cache[flagQuery, string]
duration time.Duration
}

func NewFlagClient() *FlagClient {
flagsURL := os.Getenv("FEATURESHEET_URL")
flagsURL := os.Getenv("flagsheet_URL")
if flagsURL == "" {
panic("FEATURESHEET_URL env var must be set")
panic("flagsheet_URL env var must be set")
}
flagsClient := featuresheetv1connect.NewFeatureSheetServiceClient(http.DefaultClient, flagsURL)
flagsClient := flagsheetv1connect.NewFlagSheetServiceClient(http.DefaultClient, flagsURL)
cache, err := theine.NewBuilder[flagQuery, string](1024).Build()
if err != nil {
panic(err)
Expand All @@ -54,7 +54,7 @@ func (f *FlagClient) Evaluate(ctx context.Context, feature string, entityID stri
return val, nil
}
// cache miss, call and set cache
req := connect.NewRequest(&featuresheetv1.EvaluateRequest{
req := connect.NewRequest(&flagsheetv1.EvaluateRequest{
Feature: feature,
EntityId: entityID,
})
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ module github.com/stillmatic/flagsheet
go 1.20

require (
github.com/Yiling-J/theine-go v0.3.1
github.com/bufbuild/connect-go v1.9.0
github.com/bufbuild/connect-grpchealth-go v1.1.1
github.com/datadog/mmh3 v0.0.0-20210722141835-012dc69a9e49
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.11.0
golang.org/x/oauth2 v0.9.0
google.golang.org/protobuf v1.31.0
gopkg.in/Iwark/spreadsheet.v2 v2.0.0-20220412131121-41eea1483964
)

require (
cloud.google.com/go/compute/metadata v0.2.0 // indirect
github.com/Yiling-J/theine-go v0.3.1 // indirect
github.com/bufbuild/connect-go v1.9.0 // indirect
github.com/bufbuild/connect-grpchealth-go v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gammazero/deque v0.2.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/ncw/directio v1.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/bufbuild/connect-go v1.9.0 h1:JIgAeNuFpo+SUPfU19Yt5TcWlznsN5Bv10/gI/6
github.com/bufbuild/connect-go v1.9.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8=
github.com/bufbuild/connect-grpchealth-go v1.1.1 h1:ldceS3m7+Qvl3GI4yzB4oCg3uOdD+Y1bytc/5xuMpqo=
github.com/bufbuild/connect-grpchealth-go v1.1.1/go.mod h1:9KbkogLoUIxOTPKyWDv5evkawr1IYXaHax4XoUHCgoQ=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/datadog/mmh3 v0.0.0-20210722141835-012dc69a9e49 h1:9ppqviquwkVpmVM19utHENs1+Ugp4odEBUbFsqP2f/M=
github.com/datadog/mmh3 v0.0.0-20210722141835-012dc69a9e49/go.mod h1:NoK5OFSzgNJ9DLcHQ3hhbZKeJZioh9B8G59FOAlytYU=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -17,17 +19,19 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/ncw/directio v1.0.5 h1:JSUBhdjEvVaJvOoyPAbcW0fnd0tvRXD76wEfZ1KcQz4=
github.com/ncw/directio v1.0.5/go.mod h1:rX/pKEYkOXBGOggmcyJeJGloCkleSvphPx2eV3t6ROk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand All @@ -49,13 +53,10 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/Iwark/spreadsheet.v2 v2.0.0-20220412131121-41eea1483964 h1:p1D1iXcLwJbzVCvaIY4kjn1x/x+1ZR3M7D03Sk7l+QY=
gopkg.in/Iwark/spreadsheet.v2 v2.0.0-20220412131121-41eea1483964/go.mod h1:AJiLW20RvjD8NFw7OxNQFAWXlvIJeb9TDTGBsfCzFcM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down

0 comments on commit f1ed1ef

Please sign in to comment.