Skip to content

Commit

Permalink
edgesync fold (#96)
Browse files Browse the repository at this point in the history
* update dependencies
* update log messages for clarity and consistency, aligning with topaz edge sync plugin
  • Loading branch information
gertd authored Jul 19, 2024
1 parent 3787962 commit 35d7adf
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/aserto-dev/go-edge-ds

go 1.22

toolchain go1.22.2
toolchain go1.22.5

// replace github.com/aserto-dev/azm => ../azm
// replace github.com/aserto-dev/go-directory => ../go-directory
Expand All @@ -13,7 +13,7 @@ require (
github.com/aserto-dev/azm v0.1.11
github.com/aserto-dev/errors v0.0.8
github.com/aserto-dev/go-directory v0.31.5
github.com/bufbuild/protovalidate-go v0.6.2
github.com/bufbuild/protovalidate-go v0.6.3
github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a
github.com/gonvenience/ytbx v1.4.4
github.com/google/uuid v1.6.0
Expand All @@ -22,11 +22,11 @@ require (
github.com/panmari/cuckoofilter v1.0.6
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/samber/lo v1.44.0
github.com/samber/lo v1.46.0
github.com/stretchr/testify v1.9.0
go.etcd.io/bbolt v1.3.10
golang.org/x/sync v0.7.0
google.golang.org/grpc v1.64.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
)

Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ github.com/aserto-dev/header v0.0.7/go.mod h1:wDF2S9k2q3lbilNb9q20vPpX8uvlSLYGa4
github.com/aserto-dev/logger v0.0.3 h1:lBB5LMdOsHCJKfEej2xY7s4OzCWUWCBhkhUU6RJ4LbM=
github.com/aserto-dev/logger v0.0.3/go.mod h1:8HIZAwlf+Y0V33YnGILYZOtYh1Eue5mz1YNf1XbqPbI=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bufbuild/protovalidate-go v0.6.2 h1:U/V3CGF0kPlR12v41rjO4DrYZtLcS4ZONLmWN+rJVCQ=
github.com/bufbuild/protovalidate-go v0.6.2/go.mod h1:4BR3rKEJiUiTy+sqsusFn2ladOf0kYmA2Reo6BHSBgQ=
github.com/bufbuild/protovalidate-go v0.6.3 h1:wxQyzW035zM16Binbaz/nWAzS12dRIXhZdSUWRY7Fv0=
github.com/bufbuild/protovalidate-go v0.6.3/go.mod h1:J4PtwP9Z2YAGgB0+o+tTWEDtLtXvz/gfhFZD8pbzM/U=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
Expand Down Expand Up @@ -147,8 +147,8 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/samber/lo v1.44.0 h1:5il56KxRE+GHsm1IR+sZ/6J42NODigFiqCWpSc2dybA=
github.com/samber/lo v1.44.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/samber/lo v1.46.0 h1:w8G+oaCPgz1PoCJztqymCFaKwXt+5cCXn51uPxExFfQ=
github.com/samber/lo v1.46.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
Expand Down Expand Up @@ -257,8 +257,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
19 changes: 15 additions & 4 deletions pkg/datasync/datasync.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ func Toggle(b, flag Mode) Mode { return b ^ flag }
func Has(b, flag Mode) bool { return b&flag != 0 }

var modes = map[int32]string{
int32(Manifest): "manifest",
int32(Full): "full",
int32(Diff): "diff",
int32(Watermark): "watermark",
int32(Manifest): "MANIFEST",
int32(Full): "FULL",
int32(Diff): "DIFF",
int32(Watermark): "WATERMARK",
}

func (m Mode) String() string {
Expand All @@ -140,6 +140,17 @@ func (m Mode) String() string {
return strings.Join(str, "|")
}

func (m Mode) RunMode() string {
mode := Clear(m, Manifest)
str := []string{}
for k, v := range modes {
if Has(mode, Mode(k)) {
str = append(str, v)
}
}
return strings.Join(str, "|")
}

func StrToMode(s string) Mode {
for k, v := range modes {
if v == s {
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasync/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

func (s *Sync) syncDirectory(ctx context.Context, conn *grpc.ClientConn) error {
runStartTime := time.Now().UTC()
s.logger.Info().Str(status, started).Str("mode", s.options.Mode.String()).Msg(syncRun)
s.logger.Info().Str(status, started).Str("mode", s.options.Mode.RunMode()).Msg(syncRun)

defer func() {
close(s.errChan)
Expand Down
4 changes: 2 additions & 2 deletions pkg/datasync/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func (s *Sync) syncManifest(ctx context.Context, conn *grpc.ClientConn) error {
runStartTime := time.Now().UTC()
s.logger.Info().Str(status, started).Str("mode", s.options.Mode.String()).Msg(syncManifest)
s.logger.Info().Str(status, started).Str("mode", Manifest.String()).Msg(syncManifest)

ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down Expand Up @@ -73,7 +73,7 @@ func (s *Sync) syncManifest(ctx context.Context, conn *grpc.ClientConn) error {
}

runEndTime := time.Now().UTC()
s.logger.Info().Str(status, finished).Str("duration", runEndTime.Sub(runStartTime).String()).Msg(syncManifest)
s.logger.Info().Str(status, finished).Str("mode", Manifest.String()).Str("duration", runEndTime.Sub(runStartTime).String()).Msg(syncManifest)

return s.store.MC().UpdateModel(m)
}
Expand Down

0 comments on commit 35d7adf

Please sign in to comment.