diff --git a/go.mod b/go.mod index 82a529b..ddd9733 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 @@ -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 ) diff --git a/go.sum b/go.sum index e76b545..a622321 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= @@ -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= diff --git a/pkg/datasync/datasync.go b/pkg/datasync/datasync.go index a1f560f..e23f191 100644 --- a/pkg/datasync/datasync.go +++ b/pkg/datasync/datasync.go @@ -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 { @@ -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 { diff --git a/pkg/datasync/directory.go b/pkg/datasync/directory.go index e9c8544..ea84449 100644 --- a/pkg/datasync/directory.go +++ b/pkg/datasync/directory.go @@ -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) diff --git a/pkg/datasync/manifest.go b/pkg/datasync/manifest.go index c536caf..4100696 100644 --- a/pkg/datasync/manifest.go +++ b/pkg/datasync/manifest.go @@ -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() @@ -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) }