From 0fa23a9b14e59f8d0b23300058604193b2a12635 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 21 Apr 2023 13:04:44 +0300 Subject: [PATCH 001/323] [#63] transformer: Add context to methods Signed-off-by: Evgenii Stratonikov --- object/transformer/channel.go | 14 ++++++++---- object/transformer/channel_test.go | 6 ++++-- object/transformer/transformer.go | 29 +++++++++++++------------ object/transformer/transformer_test.go | 30 ++++++++++++++------------ object/transformer/types.go | 8 +++---- 5 files changed, 49 insertions(+), 38 deletions(-) diff --git a/object/transformer/channel.go b/object/transformer/channel.go index e1c009b..b7a50a9 100644 --- a/object/transformer/channel.go +++ b/object/transformer/channel.go @@ -1,6 +1,8 @@ package transformer import ( + "context" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "github.com/nspcc-dev/neo-go/pkg/util/slice" ) @@ -20,23 +22,27 @@ func NewChannelTarget(ch chan<- *objectSDK.Object) ObjectTarget { } // WriteHeader implements the ObjectTarget interface. -func (c *chanTarget) WriteHeader(object *objectSDK.Object) error { +func (c *chanTarget) WriteHeader(_ context.Context, object *objectSDK.Object) error { c.header = object return nil } // Write implements the ObjectTarget interface. -func (c *chanTarget) Write(p []byte) (n int, err error) { +func (c *chanTarget) Write(_ context.Context, p []byte) (n int, err error) { c.payload = append(c.payload, p...) return len(p), nil } // Close implements the ObjectTarget interface. -func (c *chanTarget) Close() (*AccessIdentifiers, error) { +func (c *chanTarget) Close(ctx context.Context) (*AccessIdentifiers, error) { if len(c.payload) != 0 { c.header.SetPayload(slice.Copy(c.payload)) } - c.ch <- c.header + select { + case c.ch <- c.header: + case <-ctx.Done(): + return nil, ctx.Err() + } c.header = nil c.payload = nil diff --git a/object/transformer/channel_test.go b/object/transformer/channel_test.go index 8eef6b7..2487391 100644 --- a/object/transformer/channel_test.go +++ b/object/transformer/channel_test.go @@ -1,6 +1,7 @@ package transformer import ( + "context" "crypto/rand" "testing" @@ -29,8 +30,9 @@ func TestChannelTarget(t *testing.T) { payload := make([]byte, maxSize*2+maxSize/2) _, _ = rand.Read(payload) - expectedIDs := writeObject(t, testTarget, hdr, payload) - actualIDs := writeObject(t, chTarget, hdr, payload) + ctx := context.Background() + expectedIDs := writeObject(t, ctx, testTarget, hdr, payload) + actualIDs := writeObject(t, ctx, chTarget, hdr, payload) _ = expectedIDs _ = actualIDs //require.Equal(t, expectedIDs, actualIDs) diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index efe3d98..7493387 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -1,6 +1,7 @@ package transformer import ( + "context" "crypto/ecdsa" "crypto/sha256" "fmt" @@ -52,7 +53,7 @@ func NewPayloadSizeLimiter(p Params) ObjectTarget { } } -func (s *payloadSizeLimiter) WriteHeader(hdr *object.Object) error { +func (s *payloadSizeLimiter) WriteHeader(_ context.Context, hdr *object.Object) error { s.current = fromObject(hdr) s.initialize() @@ -60,16 +61,16 @@ func (s *payloadSizeLimiter) WriteHeader(hdr *object.Object) error { return nil } -func (s *payloadSizeLimiter) Write(p []byte) (int, error) { - if err := s.writeChunk(p); err != nil { +func (s *payloadSizeLimiter) Write(ctx context.Context, p []byte) (int, error) { + if err := s.writeChunk(ctx, p); err != nil { return 0, err } return len(p), nil } -func (s *payloadSizeLimiter) Close() (*AccessIdentifiers, error) { - return s.release(true) +func (s *payloadSizeLimiter) Close(ctx context.Context) (*AccessIdentifiers, error) { + return s.release(ctx, true) } func (s *payloadSizeLimiter) initialize() { @@ -132,7 +133,7 @@ func (s *payloadSizeLimiter) initPayloadHashers() { } // nolint: funlen -func (s *payloadSizeLimiter) release(finalize bool) (*AccessIdentifiers, error) { +func (s *payloadSizeLimiter) release(ctx context.Context, finalize bool) (*AccessIdentifiers, error) { // Arg finalize is true only when called from Close method. // We finalize parent and generate linking objects only if it is more // than 1 object in split-chain. @@ -185,11 +186,11 @@ func (s *payloadSizeLimiter) release(finalize bool) (*AccessIdentifiers, error) return nil, fmt.Errorf("could not finalize object: %w", err) } - if err := s.NextTarget.WriteHeader(s.current); err != nil { + if err := s.NextTarget.WriteHeader(ctx, s.current); err != nil { return nil, fmt.Errorf("could not write header to next target: %w", err) } - if _, err := s.NextTarget.Close(); err != nil { + if _, err := s.NextTarget.Close(ctx); err != nil { return nil, fmt.Errorf("could not close next target: %w", err) } @@ -209,7 +210,7 @@ func (s *payloadSizeLimiter) release(finalize bool) (*AccessIdentifiers, error) s.initializeLinking(ids.ParentHeader) s.initializeCurrent() - if _, err := s.release(false); err != nil { + if _, err := s.release(ctx, false); err != nil { return nil, fmt.Errorf("could not release linking object: %w", err) } } @@ -224,7 +225,7 @@ func (s *payloadSizeLimiter) initializeLinking(parHdr *object.Object) { s.current.SetSplitID(s.splitID) } -func (s *payloadSizeLimiter) writeChunk(chunk []byte) error { +func (s *payloadSizeLimiter) writeChunk(ctx context.Context, chunk []byte) error { for { // statement is true if the previous write of bytes reached exactly the boundary. if s.written > 0 && s.written%s.MaxSize == 0 { @@ -233,7 +234,7 @@ func (s *payloadSizeLimiter) writeChunk(chunk []byte) error { } // we need to release current object - if _, err := s.release(false); err != nil { + if _, err := s.release(ctx, false); err != nil { return fmt.Errorf("could not release object: %w", err) } @@ -252,7 +253,7 @@ func (s *payloadSizeLimiter) writeChunk(chunk []byte) error { cut = leftToEdge } - if err := s.writeHashes(chunk[:cut]); err != nil { + if err := s.writeHashes(ctx, chunk[:cut]); err != nil { return fmt.Errorf("could not write chunk to target: %w", err) } @@ -268,8 +269,8 @@ func (s *payloadSizeLimiter) writeChunk(chunk []byte) error { } } -func (s *payloadSizeLimiter) writeHashes(chunk []byte) error { - _, err := s.NextTarget.Write(chunk) +func (s *payloadSizeLimiter) writeHashes(ctx context.Context, chunk []byte) error { + _, err := s.NextTarget.Write(ctx, chunk) if err != nil { return err } diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index 1e06bc5..270697e 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -1,6 +1,7 @@ package transformer import ( + "context" "crypto/rand" "crypto/sha256" "testing" @@ -31,7 +32,7 @@ func TestTransformer(t *testing.T) { expectedPayload := make([]byte, maxSize*2+maxSize/2) _, _ = rand.Read(expectedPayload) - ids := writeObject(t, target, hdr, expectedPayload) + ids := writeObject(t, context.Background(), target, hdr, expectedPayload) require.Equal(t, 4, len(tt.objects)) // 3 parts + linking object var actualPayload []byte @@ -85,13 +86,13 @@ func newObject(cnr cid.ID) *objectSDK.Object { return hdr } -func writeObject(t *testing.T, target ObjectTarget, header *objectSDK.Object, payload []byte) *AccessIdentifiers { - require.NoError(t, target.WriteHeader(header)) +func writeObject(t *testing.T, ctx context.Context, target ObjectTarget, header *objectSDK.Object, payload []byte) *AccessIdentifiers { + require.NoError(t, target.WriteHeader(ctx, header)) - _, err := target.Write(payload) + _, err := target.Write(ctx, payload) require.NoError(t, err) - ids, err := target.Close() + ids, err := target.Close(ctx) require.NoError(t, err) return ids @@ -112,18 +113,19 @@ func benchmarkTransformer(b *testing.B, header *objectSDK.Object, payloadSize in const maxSize = 64 * 1024 * 1024 payload := make([]byte, payloadSize) + ctx := context.Background() b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { f, _ := newPayloadSizeLimiter(maxSize, benchTarget{}) - if err := f.WriteHeader(header); err != nil { + if err := f.WriteHeader(ctx, header); err != nil { b.Fatalf("write header: %v", err) } - if _, err := f.Write(payload); err != nil { + if _, err := f.Write(ctx, payload); err != nil { b.Fatalf("write: %v", err) } - if _, err := f.Close(); err != nil { + if _, err := f.Close(ctx); err != nil { b.Fatalf("close: %v", err) } } @@ -152,15 +154,15 @@ func (s dummyEpochSource) CurrentEpoch() uint64 { type benchTarget struct{} -func (benchTarget) WriteHeader(object *objectSDK.Object) error { +func (benchTarget) WriteHeader(_ context.Context, object *objectSDK.Object) error { return nil } -func (benchTarget) Write(p []byte) (n int, err error) { +func (benchTarget) Write(_ context.Context, p []byte) (n int, err error) { return len(p), nil } -func (benchTarget) Close() (*AccessIdentifiers, error) { +func (benchTarget) Close(context.Context) (*AccessIdentifiers, error) { return nil, nil } @@ -170,17 +172,17 @@ type testTarget struct { objects []*objectSDK.Object } -func (tt *testTarget) WriteHeader(object *objectSDK.Object) error { +func (tt *testTarget) WriteHeader(_ context.Context, object *objectSDK.Object) error { tt.current = object return nil } -func (tt *testTarget) Write(p []byte) (n int, err error) { +func (tt *testTarget) Write(_ context.Context, p []byte) (n int, err error) { tt.payload = append(tt.payload, p...) return len(p), nil } -func (tt *testTarget) Close() (*AccessIdentifiers, error) { +func (tt *testTarget) Close(_ context.Context) (*AccessIdentifiers, error) { tt.current.SetPayload(tt.payload) tt.objects = append(tt.objects, tt.current) tt.current = nil diff --git a/object/transformer/types.go b/object/transformer/types.go index 6f5f159..a7e827c 100644 --- a/object/transformer/types.go +++ b/object/transformer/types.go @@ -1,7 +1,7 @@ package transformer import ( - "io" + "context" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -31,14 +31,14 @@ type ObjectTarget interface { // that depends on the implementation. // // Must not be called after Close call. - WriteHeader(*object.Object) error + WriteHeader(context.Context, *object.Object) error // Write writes object payload chunk. // // Can be called multiple times. // // Must not be called after Close call. - io.Writer + Write(context.Context, []byte) (int, error) // Close is used to finish object writing. // @@ -48,7 +48,7 @@ type ObjectTarget interface { // Must be called no more than once. Control remains with the caller. // Re-calling can lead to undefined behavior // that depends on the implementation. - Close() (*AccessIdentifiers, error) + Close(context.Context) (*AccessIdentifiers, error) } // TargetInitializer represents ObjectTarget constructor. From 38b03ff28b5ca1a98712df4ed76e1b53a4a15411 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 21 Apr 2023 15:30:24 +0300 Subject: [PATCH 002/323] [#63] transformer: Resolve funlen linter Signed-off-by: Evgenii Stratonikov --- object/transformer/transformer.go | 59 +++++++++++++++++-------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index 7493387..f72ac0e 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -132,7 +132,6 @@ func (s *payloadSizeLimiter) initPayloadHashers() { } } -// nolint: funlen func (s *payloadSizeLimiter) release(ctx context.Context, finalize bool) (*AccessIdentifiers, error) { // Arg finalize is true only when called from Close method. // We finalize parent and generate linking objects only if it is more @@ -152,6 +151,36 @@ func (s *payloadSizeLimiter) release(ctx context.Context, finalize bool) (*Acces s.currentHashers[i].writeChecksum(s.current) } + ids, err := s.fillHeader() + if err != nil { + return nil, fmt.Errorf("fillHeader: %w", err) + } + + if err := s.NextTarget.WriteHeader(ctx, s.current); err != nil { + return nil, fmt.Errorf("could not write header to next target: %w", err) + } + + if _, err := s.NextTarget.Close(ctx); err != nil { + return nil, fmt.Errorf("could not close next target: %w", err) + } + + // save identifier of the released object + s.previous = append(s.previous, ids.SelfID) + + if withParent { + // generate and release linking object + s.initializeLinking(ids.ParentHeader) + s.initializeCurrent() + + if _, err := s.release(ctx, false); err != nil { + return nil, fmt.Errorf("could not release linking object: %w", err) + } + } + + return ids, nil +} + +func (s *payloadSizeLimiter) fillHeader() (*AccessIdentifiers, error) { curEpoch := s.NetworkState.CurrentEpoch() ver := version.Current() @@ -186,36 +215,12 @@ func (s *payloadSizeLimiter) release(ctx context.Context, finalize bool) (*Acces return nil, fmt.Errorf("could not finalize object: %w", err) } - if err := s.NextTarget.WriteHeader(ctx, s.current); err != nil { - return nil, fmt.Errorf("could not write header to next target: %w", err) - } - - if _, err := s.NextTarget.Close(ctx); err != nil { - return nil, fmt.Errorf("could not close next target: %w", err) - } - id, _ := s.current.ID() - - ids := &AccessIdentifiers{ + return &AccessIdentifiers{ ParentID: parID, SelfID: id, ParentHeader: parHdr, - } - - // save identifier of the released object - s.previous = append(s.previous, ids.SelfID) - - if withParent { - // generate and release linking object - s.initializeLinking(ids.ParentHeader) - s.initializeCurrent() - - if _, err := s.release(ctx, false); err != nil { - return nil, fmt.Errorf("could not release linking object: %w", err) - } - } - - return ids, nil + }, nil } func (s *payloadSizeLimiter) initializeLinking(parHdr *object.Object) { From 29b188db577d656632da7dc66f1f6b869fec9127 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 27 Apr 2023 14:04:38 +0300 Subject: [PATCH 003/323] [#52] Remove storage groups and audit Signed-off-by: Evgenii Stratonikov --- audit/doc.go | 26 --- audit/result.go | 377 ------------------------------ audit/result_test.go | 191 --------------- audit/test/doc.go | 13 -- audit/test/generate.go | 36 --- object/raw_test.go | 10 - object/type.go | 3 +- object/type_test.go | 5 - storagegroup/doc.go | 38 --- storagegroup/storagegroup.go | 329 -------------------------- storagegroup/storagegroup_test.go | 283 ---------------------- storagegroup/test/doc.go | 13 -- storagegroup/test/generate.go | 20 -- 13 files changed, 1 insertion(+), 1343 deletions(-) delete mode 100644 audit/doc.go delete mode 100644 audit/result.go delete mode 100644 audit/result_test.go delete mode 100644 audit/test/doc.go delete mode 100644 audit/test/generate.go delete mode 100644 storagegroup/doc.go delete mode 100644 storagegroup/storagegroup.go delete mode 100644 storagegroup/storagegroup_test.go delete mode 100644 storagegroup/test/doc.go delete mode 100644 storagegroup/test/generate.go diff --git a/audit/doc.go b/audit/doc.go deleted file mode 100644 index e66fb56..0000000 --- a/audit/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Package audit provides features to process data audit in FrostFS system. - -Result type groups values which can be gathered during data audit process: - - var res audit.Result - res.ForEpoch(32) - res.ForContainer(cnr) - // ... - res.Complete() - -Result instances can be stored in a binary format. On reporter side: - - data := res.Marshal() - // send data - -On receiver side: - - var res audit.Result - err := res.Unmarshal(data) - // ... - -Using package types in an application is recommended to potentially work with -different protocol versions with which these types are compatible. -*/ -package audit diff --git a/audit/result.go b/audit/result.go deleted file mode 100644 index 64dce2f..0000000 --- a/audit/result.go +++ /dev/null @@ -1,377 +0,0 @@ -package audit - -import ( - "errors" - "fmt" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" -) - -// Result represents report on the results of the data audit in FrostFS system. -// -// Result is mutually binary-compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit.DataAuditResult -// message. See Marshal / Unmarshal methods. -// -// Instances can be created using built-in var declaration. -type Result struct { - versionEncoded bool - - v2 audit.DataAuditResult -} - -// Marshal encodes Result into a canonical FrostFS binary format (Protocol Buffers -// with direct field order). -// -// Writes version.Current() protocol version into the resulting message if Result -// hasn't been already decoded from such a message using Unmarshal. -// -// See also Unmarshal. -func (r *Result) Marshal() []byte { - if !r.versionEncoded { - var verV2 refs.Version - version.Current().WriteToV2(&verV2) - r.v2.SetVersion(&verV2) - r.versionEncoded = true - } - - return r.v2.StableMarshal(nil) -} - -var errCIDNotSet = errors.New("container ID is not set") - -// Unmarshal decodes Result from its canonical FrostFS binary format (Protocol Buffers -// with direct field order). Returns an error describing a format violation. -// -// See also Marshal. -func (r *Result) Unmarshal(data []byte) error { - err := r.v2.Unmarshal(data) - if err != nil { - return err - } - - r.versionEncoded = true - - // format checks - - var cID cid.ID - - cidV2 := r.v2.GetContainerID() - if cidV2 == nil { - return errCIDNotSet - } - - err = cID.ReadFromV2(*cidV2) - if err != nil { - return fmt.Errorf("could not convert V2 container ID: %w", err) - } - - var ( - oID oid.ID - oidV2 refs.ObjectID - ) - - for _, oidV2 = range r.v2.GetPassSG() { - err = oID.ReadFromV2(oidV2) - if err != nil { - return fmt.Errorf("invalid passed storage group ID: %w", err) - } - } - - for _, oidV2 = range r.v2.GetFailSG() { - err = oID.ReadFromV2(oidV2) - if err != nil { - return fmt.Errorf("invalid failed storage group ID: %w", err) - } - } - - return nil -} - -// Epoch returns FrostFS epoch when the data associated with the Result was audited. -// -// Zero Result has zero epoch. -// -// See also ForEpoch. -func (r Result) Epoch() uint64 { - return r.v2.GetAuditEpoch() -} - -// ForEpoch specifies FrostFS epoch when the data associated with the Result was audited. -// -// See also Epoch. -func (r *Result) ForEpoch(epoch uint64) { - r.v2.SetAuditEpoch(epoch) -} - -// Container returns identifier of the container with which the data audit Result -// is associated and a bool that indicates container ID field presence in the Result. -// -// Zero Result does not have container ID. -// -// See also ForContainer. -func (r Result) Container() (cid.ID, bool) { - var cID cid.ID - - cidV2 := r.v2.GetContainerID() - if cidV2 != nil { - _ = cID.ReadFromV2(*cidV2) - return cID, true - } - - return cID, false -} - -// ForContainer sets identifier of the container with which the data audit Result -// is associated. -// -// See also Container. -func (r *Result) ForContainer(cnr cid.ID) { - var cidV2 refs.ContainerID - cnr.WriteToV2(&cidV2) - - r.v2.SetContainerID(&cidV2) -} - -// AuditorKey returns public key of the auditing FrostFS Inner Ring node in -// a FrostFS binary key format. -// -// Zero Result has nil key. Return value MUST NOT be mutated: to do this, -// first make a copy. -// -// See also SetAuditorPublicKey. -func (r Result) AuditorKey() []byte { - return r.v2.GetPublicKey() -} - -// SetAuditorKey specifies public key of the auditing FrostFS Inner Ring node in -// a FrostFS binary key format. -// -// Argument MUST NOT be mutated at least until the end of using the Result. -// -// See also AuditorKey. -func (r *Result) SetAuditorKey(key []byte) { - r.v2.SetPublicKey(key) -} - -// Completed returns completion state of the data audit associated with the Result. -// -// Zero Result corresponds to incomplete data audit. -// -// See also Complete. -func (r Result) Completed() bool { - return r.v2.GetComplete() -} - -// Complete marks the data audit associated with the Result as completed. -// -// See also Completed. -func (r *Result) Complete() { - r.v2.SetComplete(true) -} - -// RequestsPoR returns number of requests made by Proof-of-Retrievability -// audit check to get all headers of the objects inside storage groups. -// -// Zero Result has zero requests. -// -// See also SetRequestsPoR. -func (r Result) RequestsPoR() uint32 { - return r.v2.GetRequests() -} - -// SetRequestsPoR sets number of requests made by Proof-of-Retrievability -// audit check to get all headers of the objects inside storage groups. -// -// See also RequestsPoR. -func (r *Result) SetRequestsPoR(v uint32) { - r.v2.SetRequests(v) -} - -// RetriesPoR returns number of retries made by Proof-of-Retrievability -// audit check to get all headers of the objects inside storage groups. -// -// Zero Result has zero retries. -// -// See also SetRetriesPoR. -func (r Result) RetriesPoR() uint32 { - return r.v2.GetRetries() -} - -// SetRetriesPoR sets number of retries made by Proof-of-Retrievability -// audit check to get all headers of the objects inside storage groups. -// -// See also RetriesPoR. -func (r *Result) SetRetriesPoR(v uint32) { - r.v2.SetRetries(v) -} - -// IteratePassedStorageGroups iterates over all storage groups that passed -// Proof-of-Retrievability audit check and passes them into f. Breaks on f's -// false return, f MUST NOT be nil. -// -// Zero Result has no passed storage groups and doesn't call f. -// -// See also SubmitPassedStorageGroup. -func (r Result) IteratePassedStorageGroups(f func(oid.ID) bool) { - r2 := r.v2.GetPassSG() - - var id oid.ID - - for i := range r2 { - _ = id.ReadFromV2(r2[i]) - - if !f(id) { - return - } - } -} - -// SubmitPassedStorageGroup marks storage group as passed Proof-of-Retrievability -// audit check. -// -// See also IteratePassedStorageGroups. -func (r *Result) SubmitPassedStorageGroup(sg oid.ID) { - var idV2 refs.ObjectID - sg.WriteToV2(&idV2) - - r.v2.SetPassSG(append(r.v2.GetPassSG(), idV2)) -} - -// IterateFailedStorageGroups is similar to IteratePassedStorageGroups but for failed groups. -// -// See also SubmitFailedStorageGroup. -func (r Result) IterateFailedStorageGroups(f func(oid.ID) bool) { - v := r.v2.GetFailSG() - var id oid.ID - - for i := range v { - _ = id.ReadFromV2(v[i]) - if !f(id) { - return - } - } -} - -// SubmitFailedStorageGroup is similar to SubmitPassedStorageGroup but for failed groups. -// -// See also IterateFailedStorageGroups. -func (r *Result) SubmitFailedStorageGroup(sg oid.ID) { - var idV2 refs.ObjectID - sg.WriteToV2(&idV2) - - r.v2.SetFailSG(append(r.v2.GetFailSG(), idV2)) -} - -// Hits returns number of sampled objects under audit placed -// in an optimal way according to the container's placement policy -// when checking Proof-of-Placement. -// -// Zero result has zero hits. -// -// See also SetHits. -func (r Result) Hits() uint32 { - return r.v2.GetHit() -} - -// SetHits sets number of sampled objects under audit placed -// in an optimal way according to the containers placement policy -// when checking Proof-of-Placement. -// -// See also Hits. -func (r *Result) SetHits(hit uint32) { - r.v2.SetHit(hit) -} - -// Misses returns number of sampled objects under audit placed -// in suboptimal way according to the container's placement policy, -// but still at a satisfactory level when checking Proof-of-Placement. -// -// Zero Result has zero misses. -// -// See also SetMisses. -func (r Result) Misses() uint32 { - return r.v2.GetMiss() -} - -// SetMisses sets number of sampled objects under audit placed -// in suboptimal way according to the container's placement policy, -// but still at a satisfactory level when checking Proof-of-Placement. -// -// See also Misses. -func (r *Result) SetMisses(miss uint32) { - r.v2.SetMiss(miss) -} - -// Failures returns number of sampled objects under audit stored -// in a way not confirming placement policy or not found at all -// when checking Proof-of-Placement. -// -// Zero result has zero failures. -// -// See also SetFailures. -func (r Result) Failures() uint32 { - return r.v2.GetFail() -} - -// SetFailures sets number of sampled objects under audit stored -// in a way not confirming placement policy or not found at all -// when checking Proof-of-Placement. -// -// See also Failures. -func (r *Result) SetFailures(fail uint32) { - r.v2.SetFail(fail) -} - -// IteratePassedStorageNodes iterates over all storage nodes that passed at least one -// Proof-of-Data-Possession audit check and passes their public keys into f. Breaks on -// f's false return. -// -// f MUST NOT be nil and MUST NOT mutate parameter passed into it at least until -// the end of using the Result. -// -// Zero Result has no passed storage nodes and doesn't call f. -// -// See also SubmitPassedStorageNode. -func (r Result) IteratePassedStorageNodes(f func([]byte) bool) { - v := r.v2.GetPassNodes() - - for i := range v { - if !f(v[i]) { - return - } - } -} - -// SubmitPassedStorageNodes marks storage node list as passed Proof-of-Data-Possession -// audit check. The list contains public keys. -// -// Argument and its elements MUST NOT be mutated at least until the end of using the Result. -// -// See also IteratePassedStorageNodes. -func (r *Result) SubmitPassedStorageNodes(list [][]byte) { - r.v2.SetPassNodes(list) -} - -// IterateFailedStorageNodes is similar to IteratePassedStorageNodes but for failed nodes. -// -// See also SubmitPassedStorageNodes. -func (r Result) IterateFailedStorageNodes(f func([]byte) bool) { - v := r.v2.GetFailNodes() - - for i := range v { - if !f(v[i]) { - return - } - } -} - -// SubmitFailedStorageNodes is similar to SubmitPassedStorageNodes but for failed nodes. -// -// See also IterateFailedStorageNodes. -func (r *Result) SubmitFailedStorageNodes(list [][]byte) { - r.v2.SetFailNodes(list) -} diff --git a/audit/result_test.go b/audit/result_test.go deleted file mode 100644 index 520fee4..0000000 --- a/audit/result_test.go +++ /dev/null @@ -1,191 +0,0 @@ -package audit_test - -import ( - "bytes" - "testing" - - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/audit" - audittest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/audit/test" - cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" - oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" - "github.com/stretchr/testify/require" -) - -func TestResultData(t *testing.T) { - var r audit.Result - - countSG := func(passed bool, f func(oid.ID)) int { - called := 0 - - ff := func(arg oid.ID) bool { - called++ - - if f != nil { - f(arg) - } - - return true - } - - if passed { - r.IteratePassedStorageGroups(ff) - } else { - r.IterateFailedStorageGroups(ff) - } - - return called - } - - countPassSG := func(f func(oid.ID)) int { return countSG(true, f) } - countFailSG := func(f func(oid.ID)) int { return countSG(false, f) } - - countNodes := func(passed bool, f func([]byte)) int { - called := 0 - - ff := func(arg []byte) bool { - called++ - - if f != nil { - f(arg) - } - - return true - } - - if passed { - r.IteratePassedStorageNodes(ff) - } else { - r.IterateFailedStorageNodes(ff) - } - - return called - } - - countPassNodes := func(f func([]byte)) int { return countNodes(true, f) } - countFailNodes := func(f func([]byte)) int { return countNodes(false, f) } - - require.Zero(t, r.Epoch()) - _, set := r.Container() - require.False(t, set) - require.Nil(t, r.AuditorKey()) - require.False(t, r.Completed()) - require.Zero(t, r.RequestsPoR()) - require.Zero(t, r.RetriesPoR()) - require.Zero(t, countPassSG(nil)) - require.Zero(t, countFailSG(nil)) - require.Zero(t, countPassNodes(nil)) - require.Zero(t, countFailNodes(nil)) - - epoch := uint64(13) - r.ForEpoch(epoch) - require.Equal(t, epoch, r.Epoch()) - - cnr := cidtest.ID() - r.ForContainer(cnr) - cID, set := r.Container() - require.True(t, set) - require.Equal(t, cnr, cID) - - key := []byte{1, 2, 3} - r.SetAuditorKey(key) - require.Equal(t, key, r.AuditorKey()) - - r.Complete() - require.True(t, r.Completed()) - - requests := uint32(2) - r.SetRequestsPoR(requests) - require.Equal(t, requests, r.RequestsPoR()) - - retries := uint32(1) - r.SetRetriesPoR(retries) - require.Equal(t, retries, r.RetriesPoR()) - - passSG1, passSG2 := oidtest.ID(), oidtest.ID() - r.SubmitPassedStorageGroup(passSG1) - r.SubmitPassedStorageGroup(passSG2) - - called1, called2 := false, false - - require.EqualValues(t, 2, countPassSG(func(id oid.ID) { - if id.Equals(passSG1) { - called1 = true - } else if id.Equals(passSG2) { - called2 = true - } - })) - require.True(t, called1) - require.True(t, called2) - - failSG1, failSG2 := oidtest.ID(), oidtest.ID() - r.SubmitFailedStorageGroup(failSG1) - r.SubmitFailedStorageGroup(failSG2) - - called1, called2 = false, false - - require.EqualValues(t, 2, countFailSG(func(id oid.ID) { - if id.Equals(failSG1) { - called1 = true - } else if id.Equals(failSG2) { - called2 = true - } - })) - require.True(t, called1) - require.True(t, called2) - - hit := uint32(1) - r.SetHits(hit) - require.Equal(t, hit, r.Hits()) - - miss := uint32(2) - r.SetMisses(miss) - require.Equal(t, miss, r.Misses()) - - fail := uint32(3) - r.SetFailures(fail) - require.Equal(t, fail, r.Failures()) - - passNodes := [][]byte{{1}, {2}} - r.SubmitPassedStorageNodes(passNodes) - - called1, called2 = false, false - - require.EqualValues(t, 2, countPassNodes(func(arg []byte) { - if bytes.Equal(arg, passNodes[0]) { - called1 = true - } else if bytes.Equal(arg, passNodes[1]) { - called2 = true - } - })) - require.True(t, called1) - require.True(t, called2) - - failNodes := [][]byte{{3}, {4}} - r.SubmitFailedStorageNodes(failNodes) - - called1, called2 = false, false - - require.EqualValues(t, 2, countFailNodes(func(arg []byte) { - if bytes.Equal(arg, failNodes[0]) { - called1 = true - } else if bytes.Equal(arg, failNodes[1]) { - called2 = true - } - })) - require.True(t, called1) - require.True(t, called2) -} - -func TestResultEncoding(t *testing.T) { - r := *audittest.Result() - - t.Run("binary", func(t *testing.T) { - data := r.Marshal() - - var r2 audit.Result - require.NoError(t, r2.Unmarshal(data)) - - require.Equal(t, r, r2) - }) -} diff --git a/audit/test/doc.go b/audit/test/doc.go deleted file mode 100644 index 6845a06..0000000 --- a/audit/test/doc.go +++ /dev/null @@ -1,13 +0,0 @@ -/* -Package audittest provides functions for convenient testing of audit package API. - -Note that importing the package into source files is highly discouraged. - -Random instance generation functions can be useful when testing expects any value, e.g.: - - import audittest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/audit/test" - - dec := audittest.Result() - // test the value -*/ -package audittest diff --git a/audit/test/generate.go b/audit/test/generate.go deleted file mode 100644 index 6dc845d..0000000 --- a/audit/test/generate.go +++ /dev/null @@ -1,36 +0,0 @@ -package audittest - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/audit" - cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" - oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" -) - -// Result returns random audit.Result. -func Result() *audit.Result { - var x audit.Result - - x.ForContainer(cidtest.ID()) - x.SetAuditorKey([]byte("key")) - x.Complete() - x.ForEpoch(44) - x.SetHits(55) - x.SetMisses(66) - x.SetFailures(77) - x.SetRequestsPoR(88) - x.SetRequestsPoR(99) - x.SubmitFailedStorageNodes([][]byte{ - []byte("node1"), - []byte("node2"), - }) - x.SubmitPassedStorageNodes([][]byte{ - []byte("node3"), - []byte("node4"), - }) - x.SubmitPassedStorageGroup(oidtest.ID()) - x.SubmitPassedStorageGroup(oidtest.ID()) - x.SubmitFailedStorageGroup(oidtest.ID()) - x.SubmitFailedStorageGroup(oidtest.ID()) - - return &x -} diff --git a/object/raw_test.go b/object/raw_test.go index b237d16..52ac9de 100644 --- a/object/raw_test.go +++ b/object/raw_test.go @@ -220,16 +220,6 @@ func TestObject_SetSessionToken(t *testing.T) { require.Equal(t, tok, obj.SessionToken()) } -func TestObject_SetType(t *testing.T) { - obj := New() - - typ := TypeStorageGroup - - obj.SetType(typ) - - require.Equal(t, typ, obj.Type()) -} - func TestObject_CutPayload(t *testing.T) { o1 := New() diff --git a/object/type.go b/object/type.go index ec85c79..29328d3 100644 --- a/object/type.go +++ b/object/type.go @@ -9,7 +9,7 @@ type Type object.Type const ( TypeRegular Type = iota TypeTombstone - TypeStorageGroup + _ TypeLock ) @@ -25,7 +25,6 @@ func TypeFromV2(t object.Type) Type { // // String mapping: // - TypeTombstone: TOMBSTONE; -// - TypeStorageGroup: STORAGE_GROUP; // - TypeLock: LOCK; // - TypeRegular, default: REGULAR. func (t Type) String() string { diff --git a/object/type_test.go b/object/type_test.go index 394ae4a..5faa936 100644 --- a/object/type_test.go +++ b/object/type_test.go @@ -21,10 +21,6 @@ func TestType_ToV2(t *testing.T) { t: object.TypeTombstone, t2: v2object.TypeTombstone, }, - { - t: object.TypeStorageGroup, - t2: v2object.TypeStorageGroup, - }, { t: object.TypeLock, t2: v2object.TypeLock, @@ -47,7 +43,6 @@ func TestType_String(t *testing.T) { testEnumStrings(t, new(object.Type), []enumStringItem{ {val: toPtr(object.TypeTombstone), str: "TOMBSTONE"}, - {val: toPtr(object.TypeStorageGroup), str: "STORAGE_GROUP"}, {val: toPtr(object.TypeRegular), str: "REGULAR"}, {val: toPtr(object.TypeLock), str: "LOCK"}, }) diff --git a/storagegroup/doc.go b/storagegroup/doc.go deleted file mode 100644 index d268b3a..0000000 --- a/storagegroup/doc.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Package storagegroup provides features to work with information that is -used for proof of storage in FrostFS system. - -StorageGroup type groups verification values for Data Audit sessions: - - // receive sg info - - sg.ExpirationEpoch() // expiration of the storage group - sg.Members() // objects in the group - sg.ValidationDataHash() // hash for objects validation - sg.ValidationDataSize() // total objects' payload size - -Instances can be also used to process FrostFS API V2 protocol messages -(see neo.fs.v2.storagegroup package in https://git.frostfs.info/TrueCloudLab/frostfs-api). - -On client side: - - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup" - - var msg storagegroup.StorageGroup - sg.WriteToV2(&msg) - - // send msg - -On server side: - - // recv msg - - var sg StorageGroupDecimal - sg.ReadFromV2(msg) - - // process sg - -Using package types in an application is recommended to potentially work with -different protocol versions with which these types are compatible. -*/ -package storagegroup diff --git a/storagegroup/storagegroup.go b/storagegroup/storagegroup.go deleted file mode 100644 index 5b358c3..0000000 --- a/storagegroup/storagegroup.go +++ /dev/null @@ -1,329 +0,0 @@ -package storagegroup - -import ( - "errors" - "fmt" - "strconv" - - objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" - objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" -) - -// StorageGroup represents storage group of the FrostFS objects. -// -// StorageGroup is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup.StorageGroup -// message. See ReadFromMessageV2 / WriteToMessageV2 methods. -// -// Instances can be created using built-in var declaration. -// -// Note that direct typecast is not safe and may result in loss of compatibility: -// -// _ = StorageGroup(storagegroup.StorageGroup) // not recommended -type StorageGroup storagegroup.StorageGroup - -// reads StorageGroup from the storagegroup.StorageGroup message. If checkFieldPresence is set, -// returns an error on absence of any protocol-required field. -func (sg *StorageGroup) readFromV2(m storagegroup.StorageGroup, checkFieldPresence bool) error { - var err error - - h := m.GetValidationHash() - if h != nil { - err = new(checksum.Checksum).ReadFromV2(*h) - if err != nil { - return fmt.Errorf("invalid hash: %w", err) - } - } else if checkFieldPresence { - return errors.New("missing hash") - } - - members := m.GetMembers() - if len(members) > 0 { - var member oid.ID - mMembers := make(map[oid.ID]struct{}, len(members)) - var exits bool - - for i := range members { - err = member.ReadFromV2(members[i]) - if err != nil { - return fmt.Errorf("invalid member: %w", err) - } - - _, exits = mMembers[member] - if exits { - return fmt.Errorf("duplicated member %s", member) - } - - mMembers[member] = struct{}{} - } - } else if checkFieldPresence { - return errors.New("missing members") - } - - *sg = StorageGroup(m) - - return nil -} - -// ReadFromV2 reads StorageGroup from the storagegroup.StorageGroup message. -// Checks if the message conforms to FrostFS API V2 protocol. -// -// See also WriteToV2. -func (sg *StorageGroup) ReadFromV2(m storagegroup.StorageGroup) error { - return sg.readFromV2(m, true) -} - -// WriteToV2 writes StorageGroup to the storagegroup.StorageGroup message. -// The message must not be nil. -// -// See also ReadFromV2. -func (sg StorageGroup) WriteToV2(m *storagegroup.StorageGroup) { - *m = (storagegroup.StorageGroup)(sg) -} - -// ValidationDataSize returns total size of the payloads -// of objects in the storage group. -// -// Zero StorageGroup has 0 data size. -// -// See also SetValidationDataSize. -func (sg StorageGroup) ValidationDataSize() uint64 { - v2 := (storagegroup.StorageGroup)(sg) - return v2.GetValidationDataSize() -} - -// SetValidationDataSize sets total size of the payloads -// of objects in the storage group. -// -// See also ValidationDataSize. -func (sg *StorageGroup) SetValidationDataSize(epoch uint64) { - (*storagegroup.StorageGroup)(sg).SetValidationDataSize(epoch) -} - -// ValidationDataHash returns homomorphic hash from the -// concatenation of the payloads of the storage group members -// and bool that indicates checksum presence in the storage -// group. -// -// Zero StorageGroup does not have validation data checksum. -// -// See also SetValidationDataHash. -func (sg StorageGroup) ValidationDataHash() (v checksum.Checksum, isSet bool) { - v2 := (storagegroup.StorageGroup)(sg) - if checksumV2 := v2.GetValidationHash(); checksumV2 != nil { - _ = v.ReadFromV2(*checksumV2) // FIXME(@cthulhu-rider): #226 handle error - isSet = true - } - - return -} - -// SetValidationDataHash sets homomorphic hash from the -// concatenation of the payloads of the storage group members. -// -// See also ValidationDataHash. -func (sg *StorageGroup) SetValidationDataHash(hash checksum.Checksum) { - var v2 refs.Checksum - hash.WriteToV2(&v2) - - (*storagegroup.StorageGroup)(sg).SetValidationHash(&v2) -} - -// ExpirationEpoch returns last FrostFS epoch number -// of the storage group lifetime. -// -// Zero StorageGroup has 0 expiration epoch. -// -// See also SetExpirationEpoch. -func (sg StorageGroup) ExpirationEpoch() uint64 { - v2 := (storagegroup.StorageGroup)(sg) - return v2.GetExpirationEpoch() -} - -// SetExpirationEpoch sets last FrostFS epoch number -// of the storage group lifetime. -// -// See also ExpirationEpoch. -func (sg *StorageGroup) SetExpirationEpoch(epoch uint64) { - (*storagegroup.StorageGroup)(sg).SetExpirationEpoch(epoch) -} - -// Members returns strictly ordered list of -// storage group member objects. -// -// Zero StorageGroup has nil members value. -// -// See also SetMembers. -func (sg StorageGroup) Members() []oid.ID { - v2 := (storagegroup.StorageGroup)(sg) - mV2 := v2.GetMembers() - - if mV2 == nil { - return nil - } - - m := make([]oid.ID, len(mV2)) - - for i := range mV2 { - _ = m[i].ReadFromV2(mV2[i]) - } - - return m -} - -// SetMembers sets strictly ordered list of -// storage group member objects. -// -// See also Members. -func (sg *StorageGroup) SetMembers(members []oid.ID) { - mV2 := (*storagegroup.StorageGroup)(sg).GetMembers() - - if members == nil { - mV2 = nil - } else { - ln := len(members) - - if cap(mV2) >= ln { - mV2 = mV2[:0] - } else { - mV2 = make([]refs.ObjectID, 0, ln) - } - - var oidV2 refs.ObjectID - - for i := 0; i < ln; i++ { - members[i].WriteToV2(&oidV2) - mV2 = append(mV2, oidV2) - } - } - - (*storagegroup.StorageGroup)(sg).SetMembers(mV2) -} - -// Marshal marshals StorageGroup into a protobuf binary form. -// -// See also Unmarshal. -func (sg StorageGroup) Marshal() ([]byte, error) { - return (*storagegroup.StorageGroup)(&sg).StableMarshal(nil), nil -} - -// Unmarshal unmarshals protobuf binary representation of StorageGroup. -// -// See also Marshal. -func (sg *StorageGroup) Unmarshal(data []byte) error { - v2 := (*storagegroup.StorageGroup)(sg) - err := v2.Unmarshal(data) - if err != nil { - return err - } - - return sg.readFromV2(*v2, false) -} - -// MarshalJSON encodes StorageGroup to protobuf JSON format. -// -// See also UnmarshalJSON. -func (sg StorageGroup) MarshalJSON() ([]byte, error) { - v2 := (storagegroup.StorageGroup)(sg) - return v2.MarshalJSON() -} - -// UnmarshalJSON decodes StorageGroup from protobuf JSON format. -// -// See also MarshalJSON. -func (sg *StorageGroup) UnmarshalJSON(data []byte) error { - v2 := (*storagegroup.StorageGroup)(sg) - err := v2.UnmarshalJSON(data) - if err != nil { - return err - } - - return sg.readFromV2(*v2, false) -} - -// ReadFromObject assemble StorageGroup from a regular -// Object structure. Object must contain unambiguous information -// about its expiration epoch, otherwise behaviour is undefined. -// -// Returns any error appeared during storage group parsing; returns -// error if object is not of TypeStorageGroup type. -func ReadFromObject(sg *StorageGroup, o objectSDK.Object) error { - if typ := o.Type(); typ != objectSDK.TypeStorageGroup { - return fmt.Errorf("object is not of StorageGroup type: %s", typ) - } - - err := sg.Unmarshal(o.Payload()) - if err != nil { - return fmt.Errorf("could not unmarshal object: %w", err) - } - - var expObj uint64 - - for _, attr := range o.Attributes() { - if attr.Key() == objectV2.SysAttributeExpEpoch { - expObj, err = strconv.ParseUint(attr.Value(), 10, 64) - if err != nil { - return fmt.Errorf("could not get expiration from object: %w", err) - } - - break - } - } - - // Supporting deprecated functionality. - // See https://github.com/nspcc-dev/neofs-api/pull/205. - if expSG := sg.ExpirationEpoch(); expObj != expSG { - return fmt.Errorf( - "expiration does not match: from object: %d, from payload: %d", - expObj, expSG) - } - - return nil -} - -// WriteToObject writes StorageGroup to a regular -// Object structure. Object must not contain ambiguous -// information about its expiration epoch or must not -// have it at all. -// -// Written information: -// - expiration epoch; -// - object type (TypeStorageGroup); -// - raw payload. -func WriteToObject(sg StorageGroup, o *objectSDK.Object) { - sgRaw, err := sg.Marshal() - if err != nil { - // Marshal() does not return errors - // in the next API release - panic(fmt.Errorf("could not marshal storage group: %w", err)) - } - - o.SetPayload(sgRaw) - o.SetType(objectSDK.TypeStorageGroup) - - attrs := o.Attributes() - var expAttrFound bool - - for i := range attrs { - if attrs[i].Key() == objectV2.SysAttributeExpEpoch { - expAttrFound = true - attrs[i].SetValue(strconv.FormatUint(sg.ExpirationEpoch(), 10)) - - break - } - } - - if !expAttrFound { - var attr objectSDK.Attribute - - attr.SetKey(objectV2.SysAttributeExpEpoch) - attr.SetValue(strconv.FormatUint(sg.ExpirationEpoch(), 10)) - - attrs = append(attrs, attr) - } - - o.SetAttributes(attrs...) -} diff --git a/storagegroup/storagegroup_test.go b/storagegroup/storagegroup_test.go deleted file mode 100644 index 3a00064..0000000 --- a/storagegroup/storagegroup_test.go +++ /dev/null @@ -1,283 +0,0 @@ -package storagegroup_test - -import ( - "crypto/sha256" - "strconv" - "testing" - - objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - storagegroupV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup" - storagegroupV2test "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/test" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" - checksumtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum/test" - objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" - oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/storagegroup" - storagegrouptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/storagegroup/test" - "github.com/stretchr/testify/require" -) - -func TestStorageGroup(t *testing.T) { - var sg storagegroup.StorageGroup - - sz := uint64(13) - sg.SetValidationDataSize(sz) - require.Equal(t, sz, sg.ValidationDataSize()) - - cs := checksumtest.Checksum() - sg.SetValidationDataHash(cs) - cs2, set := sg.ValidationDataHash() - - require.True(t, set) - require.Equal(t, cs, cs2) - - exp := uint64(33) - sg.SetExpirationEpoch(exp) - require.Equal(t, exp, sg.ExpirationEpoch()) - - members := []oid.ID{oidtest.ID(), oidtest.ID()} - sg.SetMembers(members) - require.Equal(t, members, sg.Members()) -} - -func TestStorageGroup_ReadFromV2(t *testing.T) { - t.Run("from zero", func(t *testing.T) { - var ( - x storagegroup.StorageGroup - v2 storagegroupV2.StorageGroup - ) - - require.Error(t, x.ReadFromV2(v2)) - }) - - t.Run("from non-zero", func(t *testing.T) { - var ( - x storagegroup.StorageGroup - v2 = storagegroupV2test.GenerateStorageGroup(false) - ) - - // https://github.com/nspcc-dev/neofs-api-go/issues/394 - v2.SetMembers(generateOIDList()) - - size := v2.GetValidationDataSize() - epoch := v2.GetExpirationEpoch() - mm := v2.GetMembers() - hashV2 := v2.GetValidationHash() - - require.NoError(t, x.ReadFromV2(*v2)) - - require.Equal(t, epoch, x.ExpirationEpoch()) - require.Equal(t, size, x.ValidationDataSize()) - - var hash checksum.Checksum - require.NoError(t, hash.ReadFromV2(*hashV2)) - h, set := x.ValidationDataHash() - require.True(t, set) - require.Equal(t, hash, h) - - var oidV2 refs.ObjectID - - for i, m := range mm { - x.Members()[i].WriteToV2(&oidV2) - require.Equal(t, m, oidV2) - } - }) -} - -func TestStorageGroupEncoding(t *testing.T) { - sg := storagegrouptest.StorageGroup() - - t.Run("binary", func(t *testing.T) { - data, err := sg.Marshal() - require.NoError(t, err) - - var sg2 storagegroup.StorageGroup - require.NoError(t, sg2.Unmarshal(data)) - - require.Equal(t, sg, sg2) - }) - - t.Run("json", func(t *testing.T) { - data, err := sg.MarshalJSON() - require.NoError(t, err) - - var sg2 storagegroup.StorageGroup - require.NoError(t, sg2.UnmarshalJSON(data)) - - require.Equal(t, sg, sg2) - }) -} - -func TestStorageGroup_WriteToV2(t *testing.T) { - t.Run("zero to v2", func(t *testing.T) { - var ( - x storagegroup.StorageGroup - v2 storagegroupV2.StorageGroup - ) - - x.WriteToV2(&v2) - - require.Nil(t, v2.GetValidationHash()) - require.Nil(t, v2.GetMembers()) - require.Zero(t, v2.GetValidationDataSize()) - require.Zero(t, v2.GetExpirationEpoch()) - }) - - t.Run("non-zero to v2", func(t *testing.T) { - var ( - x = storagegrouptest.StorageGroup() - v2 storagegroupV2.StorageGroup - ) - - x.WriteToV2(&v2) - - require.Equal(t, x.ExpirationEpoch(), v2.GetExpirationEpoch()) - require.Equal(t, x.ValidationDataSize(), v2.GetValidationDataSize()) - - var hash checksum.Checksum - require.NoError(t, hash.ReadFromV2(*v2.GetValidationHash())) - - h, set := x.ValidationDataHash() - require.True(t, set) - require.Equal(t, h, hash) - - var oidV2 refs.ObjectID - - for i, m := range x.Members() { - m.WriteToV2(&oidV2) - require.Equal(t, oidV2, v2.GetMembers()[i]) - } - }) -} - -func TestNew(t *testing.T) { - t.Run("default values", func(t *testing.T) { - var sg storagegroup.StorageGroup - - // check initial values - require.Nil(t, sg.Members()) - _, set := sg.ValidationDataHash() - require.False(t, set) - require.Zero(t, sg.ExpirationEpoch()) - require.Zero(t, sg.ValidationDataSize()) - }) -} - -func generateOIDList() []refs.ObjectID { - const size = 3 - - mmV2 := make([]refs.ObjectID, size) - for i := 0; i < size; i++ { - oidV2 := make([]byte, sha256.Size) - oidV2[i] = byte(i) - - mmV2[i].SetValue(oidV2) - } - - return mmV2 -} - -func TestStorageGroup_SetMembers_DoubleSetting(t *testing.T) { - var sg storagegroup.StorageGroup - - mm := []oid.ID{oidtest.ID(), oidtest.ID(), oidtest.ID()} // cap is 3 at least - sg.SetMembers(mm) - - // the previous cap is more that a new length; - // slicing should not lead to `out of range` - // and apply update correctly - sg.SetMembers(mm[:1]) -} - -func TestStorageGroupFromObject(t *testing.T) { - sg := storagegrouptest.StorageGroup() - - var o objectSDK.Object - - var expAttr objectSDK.Attribute - expAttr.SetKey(objectV2.SysAttributeExpEpoch) - expAttr.SetValue(strconv.FormatUint(sg.ExpirationEpoch(), 10)) - - sgRaw, err := sg.Marshal() - require.NoError(t, err) - - o.SetPayload(sgRaw) - o.SetType(objectSDK.TypeStorageGroup) - - t.Run("correct object", func(t *testing.T) { - o.SetAttributes(objectSDK.Attribute{}, expAttr, objectSDK.Attribute{}) - - var sg2 storagegroup.StorageGroup - require.NoError(t, storagegroup.ReadFromObject(&sg2, o)) - require.Equal(t, sg, sg2) - }) - - t.Run("incorrect exp attr", func(t *testing.T) { - var sg2 storagegroup.StorageGroup - - expAttr.SetValue(strconv.FormatUint(sg.ExpirationEpoch()+1, 10)) - o.SetAttributes(expAttr) - - require.Error(t, storagegroup.ReadFromObject(&sg2, o)) - }) - - t.Run("incorrect object type", func(t *testing.T) { - var sg2 storagegroup.StorageGroup - - o.SetType(objectSDK.TypeTombstone) - require.Error(t, storagegroup.ReadFromObject(&sg2, o)) - }) -} - -func TestStorageGroupToObject(t *testing.T) { - sg := storagegrouptest.StorageGroup() - - sgRaw, err := sg.Marshal() - require.NoError(t, err) - - t.Run("empty object", func(t *testing.T) { - var o objectSDK.Object - storagegroup.WriteToObject(sg, &o) - - exp, found := expFromObj(t, o) - require.True(t, found) - - require.Equal(t, sgRaw, o.Payload()) - require.Equal(t, sg.ExpirationEpoch(), exp) - require.Equal(t, objectSDK.TypeStorageGroup, o.Type()) - }) - - t.Run("obj already has exp attr", func(t *testing.T) { - var o objectSDK.Object - - var attr objectSDK.Attribute - attr.SetKey(objectV2.SysAttributeExpEpoch) - attr.SetValue(strconv.FormatUint(sg.ExpirationEpoch()+1, 10)) - - o.SetAttributes(objectSDK.Attribute{}, attr, objectSDK.Attribute{}) - - storagegroup.WriteToObject(sg, &o) - - exp, found := expFromObj(t, o) - require.True(t, found) - - require.Equal(t, sgRaw, o.Payload()) - require.Equal(t, sg.ExpirationEpoch(), exp) - require.Equal(t, objectSDK.TypeStorageGroup, o.Type()) - }) -} - -func expFromObj(t *testing.T, o objectSDK.Object) (uint64, bool) { - for _, attr := range o.Attributes() { - if attr.Key() == objectV2.SysAttributeExpEpoch { - exp, err := strconv.ParseUint(attr.Value(), 10, 64) - require.NoError(t, err) - - return exp, true - } - } - - return 0, false -} diff --git a/storagegroup/test/doc.go b/storagegroup/test/doc.go deleted file mode 100644 index 03cb957..0000000 --- a/storagegroup/test/doc.go +++ /dev/null @@ -1,13 +0,0 @@ -/* -Package storagegrouptest provides functions for convenient testing of storagegroup package API. - -Note that importing the package into source files is highly discouraged. - -Random instance generation functions can be useful when testing expects any value, e.g.: - - import storagegrouptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/storagegroup/test" - - val := storagegrouptest.StorageGroup() - // test the value -*/ -package storagegrouptest diff --git a/storagegroup/test/generate.go b/storagegroup/test/generate.go deleted file mode 100644 index f7b3847..0000000 --- a/storagegroup/test/generate.go +++ /dev/null @@ -1,20 +0,0 @@ -package storagegrouptest - -import ( - checksumtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum/test" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" - oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/storagegroup" -) - -// StorageGroup returns random storagegroup.StorageGroup. -func StorageGroup() storagegroup.StorageGroup { - var x storagegroup.StorageGroup - - x.SetExpirationEpoch(66) - x.SetValidationDataSize(322) - x.SetValidationDataHash(checksumtest.Checksum()) - x.SetMembers([]oid.ID{oidtest.ID(), oidtest.ID()}) - - return x -} From c42a6119ffeb5a1e0c59674f1e0d1bc69fd1884b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 11:09:12 +0300 Subject: [PATCH 004/323] [#66] transformer: Extend tests Signed-off-by: Evgenii Stratonikov --- object/transformer/transformer.go | 6 +++--- object/transformer/transformer_test.go | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index f72ac0e..b369b2e 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -81,10 +81,10 @@ func (s *payloadSizeLimiter) initialize() { // initialize parent object once (after 1st object) if ln == 1 { s.parent = fromObject(s.current) - s.parentHashers = append(s.parentHashers[:0], s.currentHashers...) - - // return source attributes + s.parent.ResetRelations() + s.parent.SetSignature(nil) s.parent.SetAttributes(s.parAttrs...) + s.parentHashers = append(s.parentHashers[:0], s.currentHashers...) } // set previous object to the last previous identifier diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index 270697e..ca9a1da 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -55,15 +55,28 @@ func TestTransformer(t *testing.T) { require.Equal(t, h[:], cs.Value()) } + require.True(t, tt.objects[i].VerifyIDSignature()) switch i { case 0, 1: require.EqualValues(t, maxSize, len(payload)) + require.Nil(t, tt.objects[i].Parent()) case 2: require.EqualValues(t, maxSize/2, len(payload)) + parent := tt.objects[i].Parent() + require.NotNil(t, parent) + require.Nil(t, parent.SplitID()) + require.True(t, parent.VerifyIDSignature()) case 3: parID, ok := tt.objects[i].ParentID() require.True(t, ok) require.Equal(t, ids.ParentID, &parID) + + children := tt.objects[i].Children() + for j := 0; j < i; j++ { + id, ok := tt.objects[j].ID() + require.True(t, ok) + require.Equal(t, id, children[j]) + } } } require.Equal(t, expectedPayload, actualPayload) From d4fe9a193d1a9a8709f8aa8b072545a1e59cf822 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 11:18:08 +0300 Subject: [PATCH 005/323] [#66] transformer: Accept constructor in NextTarget The code of frostfs-node is not yet ready to reuse egress target for multiple objects, let's postpone until #64. Signed-off-by: Evgenii Stratonikov --- object/transformer/channel_test.go | 5 +++-- object/transformer/transformer.go | 12 +++++++----- object/transformer/transformer_test.go | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/object/transformer/channel_test.go b/object/transformer/channel_test.go index 2487391..6b17bd5 100644 --- a/object/transformer/channel_test.go +++ b/object/transformer/channel_test.go @@ -16,9 +16,10 @@ func TestChannelTarget(t *testing.T) { ch := make(chan *objectSDK.Object, 10) tt := new(testTarget) + ct := NewChannelTarget(ch) - chTarget, _ := newPayloadSizeLimiter(maxSize, NewChannelTarget(ch)) - testTarget, _ := newPayloadSizeLimiter(maxSize, tt) + chTarget, _ := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return ct }) + testTarget, _ := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return tt }) ver := version.Current() cnr := cidtest.ID() diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index b369b2e..56a7f07 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -28,11 +28,13 @@ type payloadSizeLimiter struct { splitID *object.SplitID parAttrs []object.Attribute + + nextTarget ObjectTarget } type Params struct { Key *ecdsa.PrivateKey - NextTarget ObjectTarget + NextTargetInit func() ObjectTarget SessionToken *session.Object NetworkState EpochSource MaxSize uint64 @@ -113,7 +115,7 @@ func fromObject(obj *object.Object) *object.Object { } func (s *payloadSizeLimiter) initializeCurrent() { - // create payload hashers + s.nextTarget = s.NextTargetInit() s.writtenCurrent = 0 s.initPayloadHashers() } @@ -156,11 +158,11 @@ func (s *payloadSizeLimiter) release(ctx context.Context, finalize bool) (*Acces return nil, fmt.Errorf("fillHeader: %w", err) } - if err := s.NextTarget.WriteHeader(ctx, s.current); err != nil { + if err := s.nextTarget.WriteHeader(ctx, s.current); err != nil { return nil, fmt.Errorf("could not write header to next target: %w", err) } - if _, err := s.NextTarget.Close(ctx); err != nil { + if _, err := s.nextTarget.Close(ctx); err != nil { return nil, fmt.Errorf("could not close next target: %w", err) } @@ -275,7 +277,7 @@ func (s *payloadSizeLimiter) writeChunk(ctx context.Context, chunk []byte) error } func (s *payloadSizeLimiter) writeHashes(ctx context.Context, chunk []byte) error { - _, err := s.NextTarget.Write(ctx, chunk) + _, err := s.nextTarget.Write(ctx, chunk) if err != nil { return err } diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index ca9a1da..11a6843 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -20,7 +20,7 @@ func TestTransformer(t *testing.T) { tt := new(testTarget) - target, pk := newPayloadSizeLimiter(maxSize, tt) + target, pk := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return tt }) cnr := cidtest.ID() hdr := newObject(cnr) @@ -131,7 +131,7 @@ func benchmarkTransformer(b *testing.B, header *objectSDK.Object, payloadSize in b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - f, _ := newPayloadSizeLimiter(maxSize, benchTarget{}) + f, _ := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return benchTarget{} }) if err := f.WriteHeader(ctx, header); err != nil { b.Fatalf("write header: %v", err) } @@ -144,7 +144,7 @@ func benchmarkTransformer(b *testing.B, header *objectSDK.Object, payloadSize in } } -func newPayloadSizeLimiter(maxSize uint64, nextTarget ObjectTarget) (ObjectTarget, *keys.PrivateKey) { +func newPayloadSizeLimiter(maxSize uint64, nextTarget func() ObjectTarget) (ObjectTarget, *keys.PrivateKey) { p, err := keys.NewPrivateKey() if err != nil { panic(err) @@ -152,7 +152,7 @@ func newPayloadSizeLimiter(maxSize uint64, nextTarget ObjectTarget) (ObjectTarge return NewPayloadSizeLimiter(Params{ Key: &p.PrivateKey, - NextTarget: nextTarget, + NextTargetInit: nextTarget, NetworkState: dummyEpochSource(123), MaxSize: maxSize, WithoutHomomorphicHash: true, From 15b4287092bd24a80959d19c7f3cea871cfa4feb Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 4 May 2023 18:01:07 +0300 Subject: [PATCH 006/323] [#49] bearer: Allow empty eacl if token is impersonated Signed-off-by: Denis Kirillov --- bearer/bearer.go | 6 +++--- bearer/bearer_test.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bearer/bearer.go b/bearer/bearer.go index c0a7d3f..aaea6c3 100644 --- a/bearer/bearer.go +++ b/bearer/bearer.go @@ -46,10 +46,12 @@ func (b *Token) readFromV2(m acl.BearerToken, checkFieldPresence bool) error { return errors.New("missing token body") } + b.impersonate = body.GetImpersonate() + eaclTable := body.GetEACL() if b.eaclTableSet = eaclTable != nil; b.eaclTableSet { b.eaclTable = *eacl.NewTableFromV2(eaclTable) - } else if checkFieldPresence { + } else if checkFieldPresence && !b.impersonate { return errors.New("missing eACL table") } @@ -70,8 +72,6 @@ func (b *Token) readFromV2(m acl.BearerToken, checkFieldPresence bool) error { return errors.New("missing token lifetime") } - b.impersonate = body.GetImpersonate() - sig := m.GetSignature() if b.sigSet = sig != nil; sig != nil { b.sig = *sig diff --git a/bearer/bearer_test.go b/bearer/bearer_test.go index 46826a7..5948bad 100644 --- a/bearer/bearer_test.go +++ b/bearer/bearer_test.go @@ -323,6 +323,10 @@ func TestToken_ReadFromV2(t *testing.T) { require.NoError(t, val.ReadFromV2(m)) + body.SetEACL(nil) + body.SetImpersonate(true) + require.NoError(t, val.ReadFromV2(m)) + var m2 acl.BearerToken val.WriteToV2(&m2) From 9a072a8f495305251d3ea1b5e24bbbedd9dafa10 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 15 May 2023 17:21:49 +0300 Subject: [PATCH 007/323] [#68] Replace interface{} with any Signed-off-by: Anton Nikiforov --- client/status/status.go | 2 +- client/status/v2.go | 2 +- client/status/v2_test.go | 4 +-- netmap/network_info_test.go | 64 ++++++++++++++++++------------------- netmap/policy.go | 22 ++++++------- ns/nns.go | 2 +- ns/nns_test.go | 4 +-- 7 files changed, 50 insertions(+), 50 deletions(-) diff --git a/client/status/status.go b/client/status/status.go index e9b2414..1d66b6b 100644 --- a/client/status/status.go +++ b/client/status/status.go @@ -15,7 +15,7 @@ package apistatus // It should be noted that using direct typecasting is not a compatible approach. // // To transport statuses using the FrostFS API V2 protocol, see StatusV2 interface and FromStatusV2 and ToStatusV2 functions. -type Status interface{} +type Status any // ErrFromStatus converts Status instance to error if it is failed. Returns nil on successful Status. // diff --git a/client/status/v2.go b/client/status/v2.go index 1918bbb..ff6ccec 100644 --- a/client/status/v2.go +++ b/client/status/v2.go @@ -123,7 +123,7 @@ func ToStatusV2(st Status) *status.Status { return internalErrorStatus } -func errMessageStatusV2(code interface{}, msg string) string { +func errMessageStatusV2(code any, msg string) string { const ( noMsgFmt = "status: code = %v" msgFmt = noMsgFmt + " message = %s" diff --git a/client/status/v2_test.go b/client/status/v2_test.go index a7084ba..14d4c30 100644 --- a/client/status/v2_test.go +++ b/client/status/v2_test.go @@ -12,7 +12,7 @@ func TestToStatusV2(t *testing.T) { type statusConstructor func() apistatus.Status for _, testItem := range [...]struct { - status interface{} // Status or statusConstructor + status any // Status or statusConstructor codeV2 uint64 messageV2 string }{ @@ -165,7 +165,7 @@ func TestFromStatusV2(t *testing.T) { type statusConstructor func() apistatus.Status for _, testItem := range [...]struct { - status interface{} // Status or statusConstructor + status any // Status or statusConstructor codeV2 uint64 messageV2 string }{ diff --git a/netmap/network_info_test.go b/netmap/network_info_test.go index 895a0a9..54b1b30 100644 --- a/netmap/network_info_test.go +++ b/netmap/network_info_test.go @@ -61,16 +61,16 @@ func TestNetworkInfo_MsPerBlock(t *testing.T) { } func testConfigValue(t *testing.T, - getter func(x NetworkInfo) interface{}, - setter func(x *NetworkInfo, val interface{}), - val1, val2 interface{}, - v2Key string, v2Val func(val interface{}) []byte, + getter func(x NetworkInfo) any, + setter func(x *NetworkInfo, val any), + val1, val2 any, + v2Key string, v2Val func(val any) []byte, ) { var x NetworkInfo require.Zero(t, getter(x)) - checkVal := func(exp interface{}) { + checkVal := func(exp any) { require.EqualValues(t, exp, getter(x)) var m netmap.NetworkInfo @@ -97,10 +97,10 @@ func testConfigValue(t *testing.T, func TestNetworkInfo_AuditFee(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.AuditFee() }, - func(info *NetworkInfo, val interface{}) { info.SetAuditFee(val.(uint64)) }, + func(x NetworkInfo) any { return x.AuditFee() }, + func(info *NetworkInfo, val any) { info.SetAuditFee(val.(uint64)) }, uint64(1), uint64(2), - "AuditFee", func(val interface{}) []byte { + "AuditFee", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -110,10 +110,10 @@ func TestNetworkInfo_AuditFee(t *testing.T) { func TestNetworkInfo_StoragePrice(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.StoragePrice() }, - func(info *NetworkInfo, val interface{}) { info.SetStoragePrice(val.(uint64)) }, + func(x NetworkInfo) any { return x.StoragePrice() }, + func(info *NetworkInfo, val any) { info.SetStoragePrice(val.(uint64)) }, uint64(1), uint64(2), - "BasicIncomeRate", func(val interface{}) []byte { + "BasicIncomeRate", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -123,10 +123,10 @@ func TestNetworkInfo_StoragePrice(t *testing.T) { func TestNetworkInfo_ContainerFee(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.ContainerFee() }, - func(info *NetworkInfo, val interface{}) { info.SetContainerFee(val.(uint64)) }, + func(x NetworkInfo) any { return x.ContainerFee() }, + func(info *NetworkInfo, val any) { info.SetContainerFee(val.(uint64)) }, uint64(1), uint64(2), - "ContainerFee", func(val interface{}) []byte { + "ContainerFee", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -136,10 +136,10 @@ func TestNetworkInfo_ContainerFee(t *testing.T) { func TestNetworkInfo_NamedContainerFee(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.NamedContainerFee() }, - func(info *NetworkInfo, val interface{}) { info.SetNamedContainerFee(val.(uint64)) }, + func(x NetworkInfo) any { return x.NamedContainerFee() }, + func(info *NetworkInfo, val any) { info.SetNamedContainerFee(val.(uint64)) }, uint64(1), uint64(2), - "ContainerAliasFee", func(val interface{}) []byte { + "ContainerAliasFee", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -149,10 +149,10 @@ func TestNetworkInfo_NamedContainerFee(t *testing.T) { func TestNetworkInfo_IRCandidateFee(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.IRCandidateFee() }, - func(info *NetworkInfo, val interface{}) { info.SetIRCandidateFee(val.(uint64)) }, + func(x NetworkInfo) any { return x.IRCandidateFee() }, + func(info *NetworkInfo, val any) { info.SetIRCandidateFee(val.(uint64)) }, uint64(1), uint64(2), - "InnerRingCandidateFee", func(val interface{}) []byte { + "InnerRingCandidateFee", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -162,10 +162,10 @@ func TestNetworkInfo_IRCandidateFee(t *testing.T) { func TestNetworkInfo_MaxObjectSize(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.MaxObjectSize() }, - func(info *NetworkInfo, val interface{}) { info.SetMaxObjectSize(val.(uint64)) }, + func(x NetworkInfo) any { return x.MaxObjectSize() }, + func(info *NetworkInfo, val any) { info.SetMaxObjectSize(val.(uint64)) }, uint64(1), uint64(2), - "MaxObjectSize", func(val interface{}) []byte { + "MaxObjectSize", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -175,10 +175,10 @@ func TestNetworkInfo_MaxObjectSize(t *testing.T) { func TestNetworkInfo_WithdrawalFee(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.WithdrawalFee() }, - func(info *NetworkInfo, val interface{}) { info.SetWithdrawalFee(val.(uint64)) }, + func(x NetworkInfo) any { return x.WithdrawalFee() }, + func(info *NetworkInfo, val any) { info.SetWithdrawalFee(val.(uint64)) }, uint64(1), uint64(2), - "WithdrawFee", func(val interface{}) []byte { + "WithdrawFee", func(val any) []byte { data := make([]byte, 8) binary.LittleEndian.PutUint64(data, val.(uint64)) return data @@ -188,14 +188,14 @@ func TestNetworkInfo_WithdrawalFee(t *testing.T) { func TestNetworkInfo_HomomorphicHashingDisabled(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.HomomorphicHashingDisabled() }, - func(info *NetworkInfo, val interface{}) { + func(x NetworkInfo) any { return x.HomomorphicHashingDisabled() }, + func(info *NetworkInfo, val any) { if val.(bool) { info.DisableHomomorphicHashing() } }, true, true, // it is impossible to enable hashing - "HomomorphicHashingDisabled", func(val interface{}) []byte { + "HomomorphicHashingDisabled", func(val any) []byte { data := make([]byte, 1) if val.(bool) { @@ -209,14 +209,14 @@ func TestNetworkInfo_HomomorphicHashingDisabled(t *testing.T) { func TestNetworkInfo_MaintenanceModeAllowed(t *testing.T) { testConfigValue(t, - func(x NetworkInfo) interface{} { return x.MaintenanceModeAllowed() }, - func(info *NetworkInfo, val interface{}) { + func(x NetworkInfo) any { return x.MaintenanceModeAllowed() }, + func(info *NetworkInfo, val any) { if val.(bool) { info.AllowMaintenanceMode() } }, true, true, - "MaintenanceModeAllowed", func(val interface{}) []byte { + "MaintenanceModeAllowed", func(val any) []byte { if val.(bool) { return []byte{1} } diff --git a/netmap/policy.go b/netmap/policy.go index 11aa4f6..b2dd766 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -541,17 +541,17 @@ type policyVisitor struct { antlr.DefaultErrorListener } -func (p *policyVisitor) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException) { +func (p *policyVisitor) SyntaxError(_ antlr.Recognizer, _ any, line, column int, msg string, _ antlr.RecognitionException) { p.reportError(fmt.Errorf("%w: line %d:%d %s", errSyntaxError, line, column, msg)) } -func (p *policyVisitor) reportError(err error) interface{} { +func (p *policyVisitor) reportError(err error) any { p.errors = append(p.errors, err) return nil } // VisitPolicy implements parser.QueryVisitor interface. -func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) interface{} { +func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) any { if len(p.errors) != 0 { return nil } @@ -599,7 +599,7 @@ func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) interface{} { return pl } -func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) interface{} { +func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) any { cbf, err := strconv.ParseUint(ctx.GetBackupFactor().GetText(), 10, 32) if err != nil { return p.reportError(errInvalidNumber) @@ -609,7 +609,7 @@ func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) interface{} { } // VisitRepStmt implements parser.QueryVisitor interface. -func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) interface{} { +func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) any { num, err := strconv.ParseUint(ctx.GetCount().GetText(), 10, 32) if err != nil { return p.reportError(errInvalidNumber) @@ -626,7 +626,7 @@ func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) interface{} { } // VisitSelectStmt implements parser.QueryVisitor interface. -func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) interface{} { +func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) any { res, err := strconv.ParseUint(ctx.GetCount().GetText(), 10, 32) if err != nil { return p.reportError(errInvalidNumber) @@ -652,13 +652,13 @@ func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) interface } // VisitFilterStmt implements parser.QueryVisitor interface. -func (p *policyVisitor) VisitFilterStmt(ctx *parser.FilterStmtContext) interface{} { +func (p *policyVisitor) VisitFilterStmt(ctx *parser.FilterStmtContext) any { f := p.VisitFilterExpr(ctx.GetExpr().(*parser.FilterExprContext)).(*netmap.Filter) f.SetName(ctx.GetName().GetText()) return f } -func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) interface{} { +func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) any { if eCtx := ctx.Expr(); eCtx != nil { return eCtx.Accept(p) } @@ -687,7 +687,7 @@ func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) interface } // VisitFilterKey implements parser.QueryVisitor interface. -func (p *policyVisitor) VisitFilterKey(ctx *parser.FilterKeyContext) interface{} { +func (p *policyVisitor) VisitFilterKey(ctx *parser.FilterKeyContext) any { if id := ctx.Ident(); id != nil { return id.GetText() } @@ -696,7 +696,7 @@ func (p *policyVisitor) VisitFilterKey(ctx *parser.FilterKeyContext) interface{} return str[1 : len(str)-1] } -func (p *policyVisitor) VisitFilterValue(ctx *parser.FilterValueContext) interface{} { +func (p *policyVisitor) VisitFilterValue(ctx *parser.FilterValueContext) any { if id := ctx.Ident(); id != nil { return id.GetText() } @@ -710,7 +710,7 @@ func (p *policyVisitor) VisitFilterValue(ctx *parser.FilterValueContext) interfa } // VisitExpr implements parser.QueryVisitor interface. -func (p *policyVisitor) VisitExpr(ctx *parser.ExprContext) interface{} { +func (p *policyVisitor) VisitExpr(ctx *parser.ExprContext) any { f := new(netmap.Filter) if flt := ctx.GetFilter(); flt != nil { f.SetName(flt.GetText()) diff --git a/ns/nns.go b/ns/nns.go index 8bbe653..3c40ab0 100644 --- a/ns/nns.go +++ b/ns/nns.go @@ -26,7 +26,7 @@ type NNS struct { nnsContract util.Uint160 invoker interface { - Call(contract util.Uint160, operation string, params ...interface{}) (*result.Invoke, error) + Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error) } } diff --git a/ns/nns_test.go b/ns/nns_test.go index 6abd3ee..3180ac4 100644 --- a/ns/nns_test.go +++ b/ns/nns_test.go @@ -29,7 +29,7 @@ type testNeoClient struct { err error } -func (x *testNeoClient) Call(contract util.Uint160, operation string, params ...interface{}) (*result.Invoke, error) { +func (x *testNeoClient) Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error) { var domain string require.Equal(x.t, x.expectedContract, contract) @@ -49,7 +49,7 @@ type brokenArrayStackItem struct { stackitem.Item } -func (x brokenArrayStackItem) Value() interface{} { +func (x brokenArrayStackItem) Value() any { return 1 } From d04d96b42ea0981c76541bcbe03315bcb6cde8a6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 14:53:25 +0300 Subject: [PATCH 008/323] [#74] go.mod: Move to go1.19 Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 704c7c3..b3a13da 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go -go 1.18 +go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230418080822-bd44a3f47b85 From 9803c2816adb0e681d6e3a08c992dbf483dca877 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 14:58:30 +0300 Subject: [PATCH 009/323] [#74] pool: move to sync/atomic Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- go.sum | 4 ---- pool/cache.go | 8 ++++---- pool/pool.go | 9 ++++++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index b3a13da..ba5b5b7 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/nspcc-dev/neo-go v0.100.1 github.com/stretchr/testify v1.8.2 - go.uber.org/atomic v1.10.0 go.uber.org/zap v1.24.0 ) @@ -42,6 +41,7 @@ require ( go.opentelemetry.io/otel/sdk v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect + go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.4.0 // indirect golang.org/x/exp v0.0.0-20221227203929-1b447090c38c // indirect diff --git a/go.sum b/go.sum index 0928962..c158159 100644 --- a/go.sum +++ b/go.sum @@ -31,10 +31,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.0 h1:oZ0/KiaFeveXRLi5VVEpuLSHczeFyWx4HDl9wTJUtsE= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.0/go.mod h1:sPyITTmQT662ZI38ud2aoE1SUCAr1mO5xV8P4nzLkKI= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230413090614-b3ccd0166f50 h1:wt7ywk0w2y2scTt7LtlObV2tWUDbme5Gm3a3Llf0C14= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230413090614-b3ccd0166f50/go.mod h1:sPyITTmQT662ZI38ud2aoE1SUCAr1mO5xV8P4nzLkKI= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230418080822-bd44a3f47b85 h1:77lvdk0kMhnUgtnmqEcAPXPQaGlt24goMPu2+E5WRTk= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230418080822-bd44a3f47b85/go.mod h1:sPyITTmQT662ZI38ud2aoE1SUCAr1mO5xV8P4nzLkKI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= diff --git a/pool/cache.go b/pool/cache.go index d86a8a7..1614e8a 100644 --- a/pool/cache.go +++ b/pool/cache.go @@ -10,7 +10,7 @@ import ( type sessionCache struct { cache *lru.Cache[string, *cacheValue] - currentEpoch uint64 + currentEpoch atomic.Uint64 } type cacheValue struct { @@ -58,14 +58,14 @@ func (c *sessionCache) DeleteByPrefix(prefix string) { } func (c *sessionCache) updateEpoch(newEpoch uint64) { - epoch := atomic.LoadUint64(&c.currentEpoch) + epoch := c.currentEpoch.Load() if newEpoch > epoch { - atomic.StoreUint64(&c.currentEpoch, newEpoch) + c.currentEpoch.Store(newEpoch) } } func (c *sessionCache) expired(val *cacheValue) bool { - epoch := atomic.LoadUint64(&c.currentEpoch) + epoch := c.currentEpoch.Load() // use epoch+1 (clear cache beforehand) to prevent 'expired session token' error right after epoch tick return val.token.ExpiredAt(epoch + 1) } diff --git a/pool/pool.go b/pool/pool.go index f7abf4c..7f4515d 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -11,6 +11,7 @@ import ( "math/rand" "sort" "sync" + "sync/atomic" "time" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" @@ -29,7 +30,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "github.com/google/uuid" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "go.uber.org/atomic" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) @@ -194,10 +194,13 @@ func newClientStatusMonitor(logger *zap.Logger, addr string, errorThreshold uint methods[i] = &methodStatus{name: i.String()} } + healthy := new(atomic.Bool) + healthy.Store(true) + return clientStatusMonitor{ logger: logger, addr: addr, - healthy: atomic.NewBool(true), + healthy: healthy, errorThreshold: errorThreshold, methods: methods, } @@ -1796,7 +1799,7 @@ func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, bufferWeights pool := p.innerPools[i] options := p.rebalanceParams - healthyChanged := atomic.NewBool(false) + healthyChanged := new(atomic.Bool) wg := sync.WaitGroup{} for j, cli := range pool.clients { From a397d1fd1523543c5042c5b13bd2a0ff7e9dcfe2 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 11:49:13 +0300 Subject: [PATCH 010/323] [#74] go.mod: Update dependencies Signed-off-by: Evgenii Stratonikov --- go.mod | 56 ++++++++++++++-------------- go.sum | 114 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 84 insertions(+), 86 deletions(-) diff --git a/go.mod b/go.mod index ba5b5b7..05d9930 100644 --- a/go.mod +++ b/go.mod @@ -3,54 +3,54 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.19 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230418080822-bd44a3f47b85 + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41 git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/hrw v1.2.0 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 github.com/google/uuid v1.3.0 - github.com/hashicorp/golang-lru/v2 v2.0.1 + github.com/hashicorp/golang-lru/v2 v2.0.2 github.com/mr-tron/base58 v1.2.0 - github.com/nspcc-dev/neo-go v0.100.1 - github.com/stretchr/testify v1.8.2 + github.com/nspcc-dev/neo-go v0.101.1 + github.com/stretchr/testify v1.8.3 go.uber.org/zap v1.24.0 ) require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 // indirect git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect github.com/hashicorp/golang-lru v0.6.0 // indirect github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb // indirect github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 // indirect + go.opentelemetry.io/otel/sdk v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.4.0 // indirect - golang.org/x/exp v0.0.0-20221227203929-1b447090c38c // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.53.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/grpc v1.55.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index c158159..9c0ac70 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230418080822-bd44a3f47b85 h1:77lvdk0kMhnUgtnmqEcAPXPQaGlt24goMPu2+E5WRTk= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230418080822-bd44a3f47b85/go.mod h1:sPyITTmQT662ZI38ud2aoE1SUCAr1mO5xV8P4nzLkKI= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41 h1:xtGsOUX8Rz0hwWIFa148URysWuD4nRHspPNbYAUc1tg= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41/go.mod h1:6wEpMfSwD5xNtQYYVHWWTHwpYuvyumyntZEzILBIXUo= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= @@ -83,8 +83,8 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= @@ -108,9 +108,8 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -139,8 +138,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -148,8 +147,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -176,8 +175,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -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/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -213,18 +213,20 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.1 h1:5pv5N1lT1fjLg2VQ5KWc7kmucp2x/kvFOnxuVTqZ6x4= -github.com/hashicorp/golang-lru/v2 v2.0.1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/golang-lru/v2 v2.0.2 h1:Dwmkdr5Nc/oBiXgJS3CDHNhJtIHkuZ3DZF5twqnfBdU= +github.com/hashicorp/golang-lru/v2 v2.0.2/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -285,8 +287,8 @@ github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkP github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM= github.com/nspcc-dev/neo-go v0.99.4/go.mod h1:mKTolfRUfKjFso5HPvGSQtUZc70n0VKBMs16eGuC5gA= -github.com/nspcc-dev/neo-go v0.100.1 h1:yugxbQRdzM+ObVa5mtr9/n4rYjxSIrryne8MVr9NBwU= -github.com/nspcc-dev/neo-go v0.100.1/go.mod h1:Nnp7F4e9IBccsgtCeLtUWV+0T6gk1PtP5HRtA13hUfc= +github.com/nspcc-dev/neo-go v0.101.1 h1:TVdcIpH/+bxQBTLRwWE3+Pw3j6j/JwguENbBSGAGid0= +github.com/nspcc-dev/neo-go v0.101.1/go.mod h1:J4tspxWw7jknX06F+VSMsKvIiNpYGfVTb2IxVC005YU= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb h1:GFxfkpXEYAbMIr69JpKOsQWeLOaGrd49HNAor8uDW+A= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= @@ -357,17 +359,13 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= @@ -391,34 +389,33 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0/go.mod h1:UFG7EBMRdXyFstOwH028U0sVf+AvukSGhF0g8+dmNG8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCBXNpHxfO/aC7PAdDsSH0IbeRQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 h1:sEL90JjOO/4yhquXl5zTAkLLsZ5+MycAgX99SDsxGc8= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0/go.mod h1:oCslUcizYdpKYyS9e8srZEqM6BB8fq41VJBjLAE6z1w= -go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= +go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0= +go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI= +go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA= +go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= +go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= @@ -434,8 +431,8 @@ golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= -golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -446,8 +443,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20221227203929-1b447090c38c h1:Govq2W3bnHJimHT2ium65kXcI7ZzTniZHcFATnLJM0Q= -golang.org/x/exp v0.0.0-20221227203929-1b447090c38c/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -508,8 +505,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -530,8 +527,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -588,8 +585,8 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -601,8 +598,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -707,8 +704,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -726,8 +723,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -741,8 +738,9 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba 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.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 57f874048be5eef927995c03dda88e510a1bd7ca Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 12:25:54 +0300 Subject: [PATCH 011/323] [#74] go.mod: Update antlr4 dependency Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 05d9930..4a8c450 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/hrw v1.2.0 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 + github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 github.com/google/uuid v1.3.0 github.com/hashicorp/golang-lru/v2 v2.0.2 github.com/mr-tron/base58 v1.2.0 diff --git a/go.sum b/go.sum index 9c0ac70..8bc61dc 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGn github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 h1:npHgfD4Tl2WJS3AJaMUi5ynGDPUBfkg3U3fCzDyXZ+4= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 h1:goHVqTbFX3AIo0tzGr14pgfAW2ZfPChKO21Z9MGf/gk= +github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= From 70f23dd1ea6d7e98eda9a67ac12e9e17ed13abf1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 12:30:27 +0300 Subject: [PATCH 012/323] [#74] pre-commit: Exclude auto-generated files Signed-off-by: Evgenii Stratonikov --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3050af4..f7f66f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - id: end-of-file-fixer - exclude: ".key$" + exclude: "(.key|.interp|.tokens)$" - repo: https://github.com/golangci/golangci-lint rev: v1.51.2 From f5b23eb225691651b8d4898c9824550c98b6da00 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 12:30:49 +0300 Subject: [PATCH 013/323] [#74] netmap/parser: Update antlr4 generator Also, add -no-listener option, as we use visitor only. Signed-off-by: Evgenii Stratonikov --- netmap/parser/Query.interp | 2 +- netmap/parser/QueryLexer.interp | 2 +- netmap/parser/generate.go | 4 +- netmap/parser/query_base_listener.go | 106 ----------- netmap/parser/query_base_visitor.go | 2 +- netmap/parser/query_lexer.go | 2 +- netmap/parser/query_listener.go | 94 ---------- netmap/parser/query_parser.go | 258 +++++++++------------------ netmap/parser/query_visitor.go | 2 +- 9 files changed, 95 insertions(+), 377 deletions(-) delete mode 100644 netmap/parser/query_base_listener.go delete mode 100644 netmap/parser/query_listener.go diff --git a/netmap/parser/Query.interp b/netmap/parser/Query.interp index 59aff71..298ddae 100644 --- a/netmap/parser/Query.interp +++ b/netmap/parser/Query.interp @@ -64,4 +64,4 @@ identWC atn: -[4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 83, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 91, 8, 5, 10, 5, 12, 5, 94, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 107, 8, 7, 1, 8, 1, 8, 3, 8, 111, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 116, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 124, 8, 12, 1, 13, 1, 13, 3, 13, 128, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 12, 13, 1, 0, 18, 19, 2, 0, 4, 6, 8, 10, 132, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 95, 1, 0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 115, 1, 0, 0, 0, 20, 117, 1, 0, 0, 0, 22, 119, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 127, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 4, 0, 0, 51, 54, 5, 18, 0, 0, 52, 53, 5, 5, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 7, 0, 0, 57, 58, 5, 18, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 8, 0, 0, 60, 66, 5, 18, 0, 0, 61, 63, 5, 5, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 9, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5, 6, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 14, 0, 0, 78, 79, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80, 83, 1, 0, 0, 0, 81, 83, 3, 14, 7, 0, 82, 76, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 92, 1, 0, 0, 0, 84, 85, 10, 4, 0, 0, 85, 86, 5, 1, 0, 0, 86, 91, 3, 10, 5, 5, 87, 88, 10, 3, 0, 0, 88, 89, 5, 2, 0, 0, 89, 91, 3, 10, 5, 4, 90, 84, 1, 0, 0, 0, 90, 87, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 95, 96, 5, 10, 0, 0, 96, 97, 3, 10, 5, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3, 24, 12, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 16, 0, 0, 101, 107, 3, 24, 12, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 3, 0, 0, 104, 105, 3, 18, 9, 0, 105, 107, 1, 0, 0, 0, 106, 100, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107, 15, 1, 0, 0, 0, 108, 111, 3, 24, 12, 0, 109, 111, 5, 20, 0, 0, 110, 108, 1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 17, 1, 0, 0, 0, 112, 116, 3, 24, 12, 0, 113, 116, 3, 20, 10, 0, 114, 116, 5, 20, 0, 0, 115, 112, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 19, 1, 0, 0, 0, 117, 118, 7, 1, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 7, 2, 0, 0, 120, 23, 1, 0, 0, 0, 121, 124, 3, 22, 11, 0, 122, 124, 5, 17, 0, 0, 123, 121, 1, 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 25, 1, 0, 0, 0, 125, 128, 3, 24, 12, 0, 126, 128, 5, 11, 0, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, 128, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 82, 90, 92, 106, 110, 115, 123, 127] +[4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 83, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 91, 8, 5, 10, 5, 12, 5, 94, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 107, 8, 7, 1, 8, 1, 8, 3, 8, 111, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 116, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 124, 8, 12, 1, 13, 1, 13, 3, 13, 128, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 12, 13, 1, 0, 18, 19, 2, 0, 4, 6, 8, 10, 132, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 95, 1, 0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 115, 1, 0, 0, 0, 20, 117, 1, 0, 0, 0, 22, 119, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 127, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 4, 0, 0, 51, 54, 5, 18, 0, 0, 52, 53, 5, 5, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 7, 0, 0, 57, 58, 5, 18, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 8, 0, 0, 60, 66, 5, 18, 0, 0, 61, 63, 5, 5, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 9, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5, 6, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 14, 0, 0, 78, 79, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80, 83, 1, 0, 0, 0, 81, 83, 3, 14, 7, 0, 82, 76, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 92, 1, 0, 0, 0, 84, 85, 10, 4, 0, 0, 85, 86, 5, 1, 0, 0, 86, 91, 3, 10, 5, 5, 87, 88, 10, 3, 0, 0, 88, 89, 5, 2, 0, 0, 89, 91, 3, 10, 5, 4, 90, 84, 1, 0, 0, 0, 90, 87, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 95, 96, 5, 10, 0, 0, 96, 97, 3, 10, 5, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3, 24, 12, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 16, 0, 0, 101, 107, 3, 24, 12, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 3, 0, 0, 104, 105, 3, 18, 9, 0, 105, 107, 1, 0, 0, 0, 106, 100, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107, 15, 1, 0, 0, 0, 108, 111, 3, 24, 12, 0, 109, 111, 5, 20, 0, 0, 110, 108, 1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 17, 1, 0, 0, 0, 112, 116, 3, 24, 12, 0, 113, 116, 3, 20, 10, 0, 114, 116, 5, 20, 0, 0, 115, 112, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 19, 1, 0, 0, 0, 117, 118, 7, 1, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 7, 2, 0, 0, 120, 23, 1, 0, 0, 0, 121, 124, 3, 22, 11, 0, 122, 124, 5, 17, 0, 0, 123, 121, 1, 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 25, 1, 0, 0, 0, 125, 128, 3, 24, 12, 0, 126, 128, 5, 11, 0, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, 128, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 82, 90, 92, 106, 110, 115, 123, 127] \ No newline at end of file diff --git a/netmap/parser/QueryLexer.interp b/netmap/parser/QueryLexer.interp index 40241c2..80a47ce 100644 --- a/netmap/parser/QueryLexer.interp +++ b/netmap/parser/QueryLexer.interp @@ -84,4 +84,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 77, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 5, 16, 137, 8, 16, 10, 16, 12, 16, 140, 9, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 148, 8, 19, 10, 19, 12, 19, 151, 9, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 158, 8, 21, 10, 21, 12, 21, 161, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 167, 8, 21, 10, 21, 12, 21, 170, 9, 21, 1, 21, 3, 21, 173, 8, 21, 1, 22, 1, 22, 1, 22, 3, 22, 178, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 4, 27, 193, 8, 27, 11, 27, 12, 27, 194, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 0, 39, 18, 41, 19, 43, 20, 45, 0, 47, 0, 49, 0, 51, 0, 53, 0, 55, 21, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 205, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 61, 1, 0, 0, 0, 5, 76, 1, 0, 0, 0, 7, 78, 1, 0, 0, 0, 9, 82, 1, 0, 0, 0, 11, 85, 1, 0, 0, 0, 13, 88, 1, 0, 0, 0, 15, 92, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 104, 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 118, 1, 0, 0, 0, 27, 127, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 133, 1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 145, 1, 0, 0, 0, 41, 152, 1, 0, 0, 0, 43, 172, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 179, 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 187, 1, 0, 0, 0, 53, 189, 1, 0, 0, 0, 55, 192, 1, 0, 0, 0, 57, 58, 5, 65, 0, 0, 58, 59, 5, 78, 0, 0, 59, 60, 5, 68, 0, 0, 60, 2, 1, 0, 0, 0, 61, 62, 5, 79, 0, 0, 62, 63, 5, 82, 0, 0, 63, 4, 1, 0, 0, 0, 64, 65, 5, 69, 0, 0, 65, 77, 5, 81, 0, 0, 66, 67, 5, 78, 0, 0, 67, 77, 5, 69, 0, 0, 68, 69, 5, 71, 0, 0, 69, 77, 5, 69, 0, 0, 70, 71, 5, 71, 0, 0, 71, 77, 5, 84, 0, 0, 72, 73, 5, 76, 0, 0, 73, 77, 5, 84, 0, 0, 74, 75, 5, 76, 0, 0, 75, 77, 5, 69, 0, 0, 76, 64, 1, 0, 0, 0, 76, 66, 1, 0, 0, 0, 76, 68, 1, 0, 0, 0, 76, 70, 1, 0, 0, 0, 76, 72, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 6, 1, 0, 0, 0, 78, 79, 5, 82, 0, 0, 79, 80, 5, 69, 0, 0, 80, 81, 5, 80, 0, 0, 81, 8, 1, 0, 0, 0, 82, 83, 5, 73, 0, 0, 83, 84, 5, 78, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 65, 0, 0, 86, 87, 5, 83, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 67, 0, 0, 89, 90, 5, 66, 0, 0, 90, 91, 5, 70, 0, 0, 91, 14, 1, 0, 0, 0, 92, 93, 5, 83, 0, 0, 93, 94, 5, 69, 0, 0, 94, 95, 5, 76, 0, 0, 95, 96, 5, 69, 0, 0, 96, 97, 5, 67, 0, 0, 97, 98, 5, 84, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 70, 0, 0, 100, 101, 5, 82, 0, 0, 101, 102, 5, 79, 0, 0, 102, 103, 5, 77, 0, 0, 103, 18, 1, 0, 0, 0, 104, 105, 5, 70, 0, 0, 105, 106, 5, 73, 0, 0, 106, 107, 5, 76, 0, 0, 107, 108, 5, 84, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 82, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 42, 0, 0, 112, 22, 1, 0, 0, 0, 113, 114, 5, 83, 0, 0, 114, 115, 5, 65, 0, 0, 115, 116, 5, 77, 0, 0, 116, 117, 5, 69, 0, 0, 117, 24, 1, 0, 0, 0, 118, 119, 5, 68, 0, 0, 119, 120, 5, 73, 0, 0, 120, 121, 5, 83, 0, 0, 121, 122, 5, 84, 0, 0, 122, 123, 5, 73, 0, 0, 123, 124, 5, 78, 0, 0, 124, 125, 5, 67, 0, 0, 125, 126, 5, 84, 0, 0, 126, 26, 1, 0, 0, 0, 127, 128, 5, 40, 0, 0, 128, 28, 1, 0, 0, 0, 129, 130, 5, 41, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 64, 0, 0, 132, 32, 1, 0, 0, 0, 133, 138, 3, 37, 18, 0, 134, 137, 3, 35, 17, 0, 135, 137, 3, 37, 18, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 140, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 34, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 141, 142, 7, 0, 0, 0, 142, 36, 1, 0, 0, 0, 143, 144, 7, 1, 0, 0, 144, 38, 1, 0, 0, 0, 145, 149, 7, 2, 0, 0, 146, 148, 3, 35, 17, 0, 147, 146, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 40, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, 152, 153, 5, 48, 0, 0, 153, 42, 1, 0, 0, 0, 154, 159, 5, 34, 0, 0, 155, 158, 3, 45, 22, 0, 156, 158, 3, 53, 26, 0, 157, 155, 1, 0, 0, 0, 157, 156, 1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 173, 5, 34, 0, 0, 163, 168, 5, 39, 0, 0, 164, 167, 3, 45, 22, 0, 165, 167, 3, 51, 25, 0, 166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 173, 5, 39, 0, 0, 172, 154, 1, 0, 0, 0, 172, 163, 1, 0, 0, 0, 173, 44, 1, 0, 0, 0, 174, 177, 5, 92, 0, 0, 175, 178, 7, 3, 0, 0, 176, 178, 3, 47, 23, 0, 177, 175, 1, 0, 0, 0, 177, 176, 1, 0, 0, 0, 178, 46, 1, 0, 0, 0, 179, 180, 5, 117, 0, 0, 180, 181, 3, 49, 24, 0, 181, 182, 3, 49, 24, 0, 182, 183, 3, 49, 24, 0, 183, 184, 3, 49, 24, 0, 184, 48, 1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 50, 1, 0, 0, 0, 187, 188, 8, 5, 0, 0, 188, 52, 1, 0, 0, 0, 189, 190, 8, 6, 0, 0, 190, 54, 1, 0, 0, 0, 191, 193, 7, 7, 0, 0, 192, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 27, 0, 0, 197, 56, 1, 0, 0, 0, 12, 0, 76, 136, 138, 149, 157, 159, 166, 168, 172, 177, 194, 1, 6, 0, 0] +[4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 77, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 5, 16, 137, 8, 16, 10, 16, 12, 16, 140, 9, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 148, 8, 19, 10, 19, 12, 19, 151, 9, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 158, 8, 21, 10, 21, 12, 21, 161, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 167, 8, 21, 10, 21, 12, 21, 170, 9, 21, 1, 21, 3, 21, 173, 8, 21, 1, 22, 1, 22, 1, 22, 3, 22, 178, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 4, 27, 193, 8, 27, 11, 27, 12, 27, 194, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 0, 39, 18, 41, 19, 43, 20, 45, 0, 47, 0, 49, 0, 51, 0, 53, 0, 55, 21, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 205, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 61, 1, 0, 0, 0, 5, 76, 1, 0, 0, 0, 7, 78, 1, 0, 0, 0, 9, 82, 1, 0, 0, 0, 11, 85, 1, 0, 0, 0, 13, 88, 1, 0, 0, 0, 15, 92, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 104, 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 118, 1, 0, 0, 0, 27, 127, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 133, 1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 145, 1, 0, 0, 0, 41, 152, 1, 0, 0, 0, 43, 172, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 179, 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 187, 1, 0, 0, 0, 53, 189, 1, 0, 0, 0, 55, 192, 1, 0, 0, 0, 57, 58, 5, 65, 0, 0, 58, 59, 5, 78, 0, 0, 59, 60, 5, 68, 0, 0, 60, 2, 1, 0, 0, 0, 61, 62, 5, 79, 0, 0, 62, 63, 5, 82, 0, 0, 63, 4, 1, 0, 0, 0, 64, 65, 5, 69, 0, 0, 65, 77, 5, 81, 0, 0, 66, 67, 5, 78, 0, 0, 67, 77, 5, 69, 0, 0, 68, 69, 5, 71, 0, 0, 69, 77, 5, 69, 0, 0, 70, 71, 5, 71, 0, 0, 71, 77, 5, 84, 0, 0, 72, 73, 5, 76, 0, 0, 73, 77, 5, 84, 0, 0, 74, 75, 5, 76, 0, 0, 75, 77, 5, 69, 0, 0, 76, 64, 1, 0, 0, 0, 76, 66, 1, 0, 0, 0, 76, 68, 1, 0, 0, 0, 76, 70, 1, 0, 0, 0, 76, 72, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 6, 1, 0, 0, 0, 78, 79, 5, 82, 0, 0, 79, 80, 5, 69, 0, 0, 80, 81, 5, 80, 0, 0, 81, 8, 1, 0, 0, 0, 82, 83, 5, 73, 0, 0, 83, 84, 5, 78, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 65, 0, 0, 86, 87, 5, 83, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 67, 0, 0, 89, 90, 5, 66, 0, 0, 90, 91, 5, 70, 0, 0, 91, 14, 1, 0, 0, 0, 92, 93, 5, 83, 0, 0, 93, 94, 5, 69, 0, 0, 94, 95, 5, 76, 0, 0, 95, 96, 5, 69, 0, 0, 96, 97, 5, 67, 0, 0, 97, 98, 5, 84, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 70, 0, 0, 100, 101, 5, 82, 0, 0, 101, 102, 5, 79, 0, 0, 102, 103, 5, 77, 0, 0, 103, 18, 1, 0, 0, 0, 104, 105, 5, 70, 0, 0, 105, 106, 5, 73, 0, 0, 106, 107, 5, 76, 0, 0, 107, 108, 5, 84, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 82, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 42, 0, 0, 112, 22, 1, 0, 0, 0, 113, 114, 5, 83, 0, 0, 114, 115, 5, 65, 0, 0, 115, 116, 5, 77, 0, 0, 116, 117, 5, 69, 0, 0, 117, 24, 1, 0, 0, 0, 118, 119, 5, 68, 0, 0, 119, 120, 5, 73, 0, 0, 120, 121, 5, 83, 0, 0, 121, 122, 5, 84, 0, 0, 122, 123, 5, 73, 0, 0, 123, 124, 5, 78, 0, 0, 124, 125, 5, 67, 0, 0, 125, 126, 5, 84, 0, 0, 126, 26, 1, 0, 0, 0, 127, 128, 5, 40, 0, 0, 128, 28, 1, 0, 0, 0, 129, 130, 5, 41, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 64, 0, 0, 132, 32, 1, 0, 0, 0, 133, 138, 3, 37, 18, 0, 134, 137, 3, 35, 17, 0, 135, 137, 3, 37, 18, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 140, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 34, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 141, 142, 7, 0, 0, 0, 142, 36, 1, 0, 0, 0, 143, 144, 7, 1, 0, 0, 144, 38, 1, 0, 0, 0, 145, 149, 7, 2, 0, 0, 146, 148, 3, 35, 17, 0, 147, 146, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 40, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, 152, 153, 5, 48, 0, 0, 153, 42, 1, 0, 0, 0, 154, 159, 5, 34, 0, 0, 155, 158, 3, 45, 22, 0, 156, 158, 3, 53, 26, 0, 157, 155, 1, 0, 0, 0, 157, 156, 1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 173, 5, 34, 0, 0, 163, 168, 5, 39, 0, 0, 164, 167, 3, 45, 22, 0, 165, 167, 3, 51, 25, 0, 166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 173, 5, 39, 0, 0, 172, 154, 1, 0, 0, 0, 172, 163, 1, 0, 0, 0, 173, 44, 1, 0, 0, 0, 174, 177, 5, 92, 0, 0, 175, 178, 7, 3, 0, 0, 176, 178, 3, 47, 23, 0, 177, 175, 1, 0, 0, 0, 177, 176, 1, 0, 0, 0, 178, 46, 1, 0, 0, 0, 179, 180, 5, 117, 0, 0, 180, 181, 3, 49, 24, 0, 181, 182, 3, 49, 24, 0, 182, 183, 3, 49, 24, 0, 183, 184, 3, 49, 24, 0, 184, 48, 1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 50, 1, 0, 0, 0, 187, 188, 8, 5, 0, 0, 188, 52, 1, 0, 0, 0, 189, 190, 8, 6, 0, 0, 190, 54, 1, 0, 0, 0, 191, 193, 7, 7, 0, 0, 192, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 27, 0, 0, 197, 56, 1, 0, 0, 0, 12, 0, 76, 136, 138, 149, 157, 159, 166, 168, 172, 177, 194, 1, 6, 0, 0] \ No newline at end of file diff --git a/netmap/parser/generate.go b/netmap/parser/generate.go index 02641a3..f2202d2 100644 --- a/netmap/parser/generate.go +++ b/netmap/parser/generate.go @@ -1,4 +1,4 @@ package parser -// ANTLR can be downloaded from https://www.antlr.org/download/antlr-4.11.1-complete.jar -//go:generate java -Xmx500M -cp "./antlr-4.11.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -visitor QueryLexer.g4 Query.g4 +// ANTLR can be downloaded from https://www.antlr.org/download/antlr-4.12.0-complete.jar +//go:generate java -Xmx500M -cp "./antlr-4.12.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -no-listener -visitor QueryLexer.g4 Query.g4 diff --git a/netmap/parser/query_base_listener.go b/netmap/parser/query_base_listener.go deleted file mode 100644 index 41dfb31..0000000 --- a/netmap/parser/query_base_listener.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT. - -package parser // Query - -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" - -// BaseQueryListener is a complete listener for a parse tree produced by Query. -type BaseQueryListener struct{} - -var _ QueryListener = &BaseQueryListener{} - -// VisitTerminal is called when a terminal node is visited. -func (s *BaseQueryListener) VisitTerminal(node antlr.TerminalNode) {} - -// VisitErrorNode is called when an error node is visited. -func (s *BaseQueryListener) VisitErrorNode(node antlr.ErrorNode) {} - -// EnterEveryRule is called when any rule is entered. -func (s *BaseQueryListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} - -// ExitEveryRule is called when any rule is exited. -func (s *BaseQueryListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} - -// EnterPolicy is called when production policy is entered. -func (s *BaseQueryListener) EnterPolicy(ctx *PolicyContext) {} - -// ExitPolicy is called when production policy is exited. -func (s *BaseQueryListener) ExitPolicy(ctx *PolicyContext) {} - -// EnterRepStmt is called when production repStmt is entered. -func (s *BaseQueryListener) EnterRepStmt(ctx *RepStmtContext) {} - -// ExitRepStmt is called when production repStmt is exited. -func (s *BaseQueryListener) ExitRepStmt(ctx *RepStmtContext) {} - -// EnterCbfStmt is called when production cbfStmt is entered. -func (s *BaseQueryListener) EnterCbfStmt(ctx *CbfStmtContext) {} - -// ExitCbfStmt is called when production cbfStmt is exited. -func (s *BaseQueryListener) ExitCbfStmt(ctx *CbfStmtContext) {} - -// EnterSelectStmt is called when production selectStmt is entered. -func (s *BaseQueryListener) EnterSelectStmt(ctx *SelectStmtContext) {} - -// ExitSelectStmt is called when production selectStmt is exited. -func (s *BaseQueryListener) ExitSelectStmt(ctx *SelectStmtContext) {} - -// EnterClause is called when production clause is entered. -func (s *BaseQueryListener) EnterClause(ctx *ClauseContext) {} - -// ExitClause is called when production clause is exited. -func (s *BaseQueryListener) ExitClause(ctx *ClauseContext) {} - -// EnterFilterExpr is called when production filterExpr is entered. -func (s *BaseQueryListener) EnterFilterExpr(ctx *FilterExprContext) {} - -// ExitFilterExpr is called when production filterExpr is exited. -func (s *BaseQueryListener) ExitFilterExpr(ctx *FilterExprContext) {} - -// EnterFilterStmt is called when production filterStmt is entered. -func (s *BaseQueryListener) EnterFilterStmt(ctx *FilterStmtContext) {} - -// ExitFilterStmt is called when production filterStmt is exited. -func (s *BaseQueryListener) ExitFilterStmt(ctx *FilterStmtContext) {} - -// EnterExpr is called when production expr is entered. -func (s *BaseQueryListener) EnterExpr(ctx *ExprContext) {} - -// ExitExpr is called when production expr is exited. -func (s *BaseQueryListener) ExitExpr(ctx *ExprContext) {} - -// EnterFilterKey is called when production filterKey is entered. -func (s *BaseQueryListener) EnterFilterKey(ctx *FilterKeyContext) {} - -// ExitFilterKey is called when production filterKey is exited. -func (s *BaseQueryListener) ExitFilterKey(ctx *FilterKeyContext) {} - -// EnterFilterValue is called when production filterValue is entered. -func (s *BaseQueryListener) EnterFilterValue(ctx *FilterValueContext) {} - -// ExitFilterValue is called when production filterValue is exited. -func (s *BaseQueryListener) ExitFilterValue(ctx *FilterValueContext) {} - -// EnterNumber is called when production number is entered. -func (s *BaseQueryListener) EnterNumber(ctx *NumberContext) {} - -// ExitNumber is called when production number is exited. -func (s *BaseQueryListener) ExitNumber(ctx *NumberContext) {} - -// EnterKeyword is called when production keyword is entered. -func (s *BaseQueryListener) EnterKeyword(ctx *KeywordContext) {} - -// ExitKeyword is called when production keyword is exited. -func (s *BaseQueryListener) ExitKeyword(ctx *KeywordContext) {} - -// EnterIdent is called when production ident is entered. -func (s *BaseQueryListener) EnterIdent(ctx *IdentContext) {} - -// ExitIdent is called when production ident is exited. -func (s *BaseQueryListener) ExitIdent(ctx *IdentContext) {} - -// EnterIdentWC is called when production identWC is entered. -func (s *BaseQueryListener) EnterIdentWC(ctx *IdentWCContext) {} - -// ExitIdentWC is called when production identWC is exited. -func (s *BaseQueryListener) ExitIdentWC(ctx *IdentWCContext) {} diff --git a/netmap/parser/query_base_visitor.go b/netmap/parser/query_base_visitor.go index 23ff011..235fd96 100644 --- a/netmap/parser/query_base_visitor.go +++ b/netmap/parser/query_base_visitor.go @@ -1,4 +1,4 @@ -// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT. +// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. package parser // Query diff --git a/netmap/parser/query_lexer.go b/netmap/parser/query_lexer.go index 7e119e0..7c24aae 100644 --- a/netmap/parser/query_lexer.go +++ b/netmap/parser/query_lexer.go @@ -1,4 +1,4 @@ -// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT. +// Code generated from QueryLexer.g4 by ANTLR 4.12.0. DO NOT EDIT. package parser diff --git a/netmap/parser/query_listener.go b/netmap/parser/query_listener.go deleted file mode 100644 index f90994c..0000000 --- a/netmap/parser/query_listener.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT. - -package parser // Query - -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" - -// QueryListener is a complete listener for a parse tree produced by Query. -type QueryListener interface { - antlr.ParseTreeListener - - // EnterPolicy is called when entering the policy production. - EnterPolicy(c *PolicyContext) - - // EnterRepStmt is called when entering the repStmt production. - EnterRepStmt(c *RepStmtContext) - - // EnterCbfStmt is called when entering the cbfStmt production. - EnterCbfStmt(c *CbfStmtContext) - - // EnterSelectStmt is called when entering the selectStmt production. - EnterSelectStmt(c *SelectStmtContext) - - // EnterClause is called when entering the clause production. - EnterClause(c *ClauseContext) - - // EnterFilterExpr is called when entering the filterExpr production. - EnterFilterExpr(c *FilterExprContext) - - // EnterFilterStmt is called when entering the filterStmt production. - EnterFilterStmt(c *FilterStmtContext) - - // EnterExpr is called when entering the expr production. - EnterExpr(c *ExprContext) - - // EnterFilterKey is called when entering the filterKey production. - EnterFilterKey(c *FilterKeyContext) - - // EnterFilterValue is called when entering the filterValue production. - EnterFilterValue(c *FilterValueContext) - - // EnterNumber is called when entering the number production. - EnterNumber(c *NumberContext) - - // EnterKeyword is called when entering the keyword production. - EnterKeyword(c *KeywordContext) - - // EnterIdent is called when entering the ident production. - EnterIdent(c *IdentContext) - - // EnterIdentWC is called when entering the identWC production. - EnterIdentWC(c *IdentWCContext) - - // ExitPolicy is called when exiting the policy production. - ExitPolicy(c *PolicyContext) - - // ExitRepStmt is called when exiting the repStmt production. - ExitRepStmt(c *RepStmtContext) - - // ExitCbfStmt is called when exiting the cbfStmt production. - ExitCbfStmt(c *CbfStmtContext) - - // ExitSelectStmt is called when exiting the selectStmt production. - ExitSelectStmt(c *SelectStmtContext) - - // ExitClause is called when exiting the clause production. - ExitClause(c *ClauseContext) - - // ExitFilterExpr is called when exiting the filterExpr production. - ExitFilterExpr(c *FilterExprContext) - - // ExitFilterStmt is called when exiting the filterStmt production. - ExitFilterStmt(c *FilterStmtContext) - - // ExitExpr is called when exiting the expr production. - ExitExpr(c *ExprContext) - - // ExitFilterKey is called when exiting the filterKey production. - ExitFilterKey(c *FilterKeyContext) - - // ExitFilterValue is called when exiting the filterValue production. - ExitFilterValue(c *FilterValueContext) - - // ExitNumber is called when exiting the number production. - ExitNumber(c *NumberContext) - - // ExitKeyword is called when exiting the keyword production. - ExitKeyword(c *KeywordContext) - - // ExitIdent is called when exiting the ident production. - ExitIdent(c *IdentContext) - - // ExitIdentWC is called when exiting the identWC production. - ExitIdentWC(c *IdentWCContext) -} diff --git a/netmap/parser/query_parser.go b/netmap/parser/query_parser.go index 578cd0e..08d40b8 100644 --- a/netmap/parser/query_parser.go +++ b/netmap/parser/query_parser.go @@ -1,4 +1,4 @@ -// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT. +// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. package parser // Query @@ -133,7 +133,7 @@ func NewQuery(input antlr.TokenStream) *Query { this.RuleNames = staticData.ruleNames this.LiteralNames = staticData.literalNames this.SymbolicNames = staticData.symbolicNames - this.GrammarFileName = "java-escape" + this.GrammarFileName = "Query.g4" return this } @@ -189,6 +189,16 @@ type IPolicyContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + EOF() antlr.TerminalNode + AllRepStmt() []IRepStmtContext + RepStmt(i int) IRepStmtContext + CbfStmt() ICbfStmtContext + AllSelectStmt() []ISelectStmtContext + SelectStmt(i int) ISelectStmtContext + AllFilterStmt() []IFilterStmtContext + FilterStmt(i int) IFilterStmtContext + // IsPolicyContext differentiates from other interfaces. IsPolicyContext() } @@ -371,18 +381,6 @@ func (s *PolicyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *PolicyContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterPolicy(s) - } -} - -func (s *PolicyContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitPolicy(s) - } -} - func (s *PolicyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -498,6 +496,12 @@ type IRepStmtContext interface { // SetSelector sets the Selector rule contexts. SetSelector(IIdentContext) + // Getter signatures + REP() antlr.TerminalNode + NUMBER1() antlr.TerminalNode + IN() antlr.TerminalNode + Ident() IIdentContext + // IsRepStmtContext differentiates from other interfaces. IsRepStmtContext() } @@ -575,18 +579,6 @@ func (s *RepStmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *RepStmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterRepStmt(s) - } -} - -func (s *RepStmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitRepStmt(s) - } -} - func (s *RepStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -668,6 +660,10 @@ type ICbfStmtContext interface { // SetBackupFactor sets the BackupFactor token. SetBackupFactor(antlr.Token) + // Getter signatures + CBF() antlr.TerminalNode + NUMBER1() antlr.TerminalNode + // IsCbfStmtContext differentiates from other interfaces. IsCbfStmtContext() } @@ -720,18 +716,6 @@ func (s *CbfStmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *CbfStmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterCbfStmt(s) - } -} - -func (s *CbfStmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitCbfStmt(s) - } -} - func (s *CbfStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -812,6 +796,17 @@ type ISelectStmtContext interface { // SetName sets the Name rule contexts. SetName(IIdentContext) + // Getter signatures + SELECT() antlr.TerminalNode + FROM() antlr.TerminalNode + NUMBER1() antlr.TerminalNode + IdentWC() IIdentWCContext + IN() antlr.TerminalNode + AS() antlr.TerminalNode + AllIdent() []IIdentContext + Ident(i int) IIdentContext + Clause() IClauseContext + // IsSelectStmtContext differentiates from other interfaces. IsSelectStmtContext() } @@ -964,18 +959,6 @@ func (s *SelectStmtContext) ToStringTree(ruleNames []string, recog antlr.Recogni return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *SelectStmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterSelectStmt(s) - } -} - -func (s *SelectStmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitSelectStmt(s) - } -} - func (s *SelectStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -1091,6 +1074,10 @@ type IClauseContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + CLAUSE_SAME() antlr.TerminalNode + CLAUSE_DISTINCT() antlr.TerminalNode + // IsClauseContext differentiates from other interfaces. IsClauseContext() } @@ -1138,18 +1125,6 @@ func (s *ClauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *ClauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterClause(s) - } -} - -func (s *ClauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitClause(s) - } -} - func (s *ClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -1231,6 +1206,15 @@ type IFilterExprContext interface { // SetF2 sets the F2 rule contexts. SetF2(IFilterExprContext) + // Getter signatures + L_PAREN() antlr.TerminalNode + R_PAREN() antlr.TerminalNode + AllFilterExpr() []IFilterExprContext + FilterExpr(i int) IFilterExprContext + Expr() IExprContext + AND_OP() antlr.TerminalNode + OR_OP() antlr.TerminalNode + // IsFilterExprContext differentiates from other interfaces. IsFilterExprContext() } @@ -1363,18 +1347,6 @@ func (s *FilterExprContext) ToStringTree(ruleNames []string, recog antlr.Recogni return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *FilterExprContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterFilterExpr(s) - } -} - -func (s *FilterExprContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitFilterExpr(s) - } -} - func (s *FilterExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -1542,6 +1514,12 @@ type IFilterStmtContext interface { // SetName sets the Name rule contexts. SetName(IIdentContext) + // Getter signatures + FILTER() antlr.TerminalNode + AS() antlr.TerminalNode + FilterExpr() IFilterExprContext + Ident() IIdentContext + // IsFilterStmtContext differentiates from other interfaces. IsFilterStmtContext() } @@ -1631,18 +1609,6 @@ func (s *FilterStmtContext) ToStringTree(ruleNames []string, recog antlr.Recogni return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *FilterStmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterFilterStmt(s) - } -} - -func (s *FilterStmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitFilterStmt(s) - } -} - func (s *FilterStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -1728,6 +1694,13 @@ type IExprContext interface { // SetValue sets the Value rule contexts. SetValue(IFilterValueContext) + // Getter signatures + AT() antlr.TerminalNode + Ident() IIdentContext + SIMPLE_OP() antlr.TerminalNode + FilterKey() IFilterKeyContext + FilterValue() IFilterValueContext + // IsExprContext differentiates from other interfaces. IsExprContext() } @@ -1838,18 +1811,6 @@ func (s *ExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) s return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *ExprContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterExpr(s) - } -} - -func (s *ExprContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitExpr(s) - } -} - func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -1936,6 +1897,10 @@ type IFilterKeyContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + Ident() IIdentContext + STRING() antlr.TerminalNode + // IsFilterKeyContext differentiates from other interfaces. IsFilterKeyContext() } @@ -1995,18 +1960,6 @@ func (s *FilterKeyContext) ToStringTree(ruleNames []string, recog antlr.Recogniz return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *FilterKeyContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterFilterKey(s) - } -} - -func (s *FilterKeyContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitFilterKey(s) - } -} - func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -2072,6 +2025,11 @@ type IFilterValueContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + Ident() IIdentContext + Number() INumberContext + STRING() antlr.TerminalNode + // IsFilterValueContext differentiates from other interfaces. IsFilterValueContext() } @@ -2147,18 +2105,6 @@ func (s *FilterValueContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *FilterValueContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterFilterValue(s) - } -} - -func (s *FilterValueContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitFilterValue(s) - } -} - func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -2231,6 +2177,10 @@ type INumberContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + ZERO() antlr.TerminalNode + NUMBER1() antlr.TerminalNode + // IsNumberContext differentiates from other interfaces. IsNumberContext() } @@ -2278,18 +2228,6 @@ func (s *NumberContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *NumberContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterNumber(s) - } -} - -func (s *NumberContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitNumber(s) - } -} - func (s *NumberContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -2347,6 +2285,14 @@ type IKeywordContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + REP() antlr.TerminalNode + IN() antlr.TerminalNode + AS() antlr.TerminalNode + SELECT() antlr.TerminalNode + FROM() antlr.TerminalNode + FILTER() antlr.TerminalNode + // IsKeywordContext differentiates from other interfaces. IsKeywordContext() } @@ -2410,18 +2356,6 @@ func (s *KeywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *KeywordContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterKeyword(s) - } -} - -func (s *KeywordContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitKeyword(s) - } -} - func (s *KeywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -2479,6 +2413,10 @@ type IIdentContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + Keyword() IKeywordContext + IDENT() antlr.TerminalNode + // IsIdentContext differentiates from other interfaces. IsIdentContext() } @@ -2538,18 +2476,6 @@ func (s *IdentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *IdentContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterIdent(s) - } -} - -func (s *IdentContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitIdent(s) - } -} - func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: @@ -2615,6 +2541,10 @@ type IIdentWCContext interface { // GetParser returns the parser. GetParser() antlr.Parser + // Getter signatures + Ident() IIdentContext + WILDCARD() antlr.TerminalNode + // IsIdentWCContext differentiates from other interfaces. IsIdentWCContext() } @@ -2674,18 +2604,6 @@ func (s *IdentWCContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *IdentWCContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.EnterIdentWC(s) - } -} - -func (s *IdentWCContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(QueryListener); ok { - listenerT.ExitIdentWC(s) - } -} - func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case QueryVisitor: diff --git a/netmap/parser/query_visitor.go b/netmap/parser/query_visitor.go index a35efde..06c0e58 100644 --- a/netmap/parser/query_visitor.go +++ b/netmap/parser/query_visitor.go @@ -1,4 +1,4 @@ -// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT. +// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. package parser // Query From 10482ffbed3b7de6e49709dcdfa1447ee0176dd6 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 30 May 2023 16:48:51 +0300 Subject: [PATCH 014/323] [#82] client: Allow to pass gRPC dial options Signed-off-by: Dmitrii Stepanov --- client/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/client.go b/client/client.go index 601f557..3942390 100644 --- a/client/client.go +++ b/client/client.go @@ -10,6 +10,7 @@ import ( v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "google.golang.org/grpc" ) // Client represents virtual connection to the FrostFS network to communicate @@ -101,6 +102,7 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error { client.WithNetworkURIAddress(prm.endpoint, prm.tlsConfig), client.WithDialTimeout(prm.timeoutDial), client.WithRWTimeout(prm.streamTimeout), + client.WithGRPCDialOptions(prm.dialOptions), )...) c.setFrostFSAPIServer((*coreServer)(&c.c)) @@ -186,6 +188,8 @@ type PrmDial struct { streamTimeoutSet bool streamTimeout time.Duration + + dialOptions []grpc.DialOption } // SetServerURI sets server URI in the FrostFS network. @@ -226,3 +230,8 @@ func (x *PrmDial) SetStreamTimeout(timeout time.Duration) { x.streamTimeoutSet = true x.streamTimeout = timeout } + +// SetGRPCDialOptions sets the gRPC dial options for new gRPC client connection. +func (x *PrmDial) SetGRPCDialOptions(opts ...grpc.DialOption) { + x.dialOptions = opts +} From 406c2324d4576d4f4152878aba097154cd7b3c0a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 1 Jun 2023 09:44:46 +0300 Subject: [PATCH 015/323] [#85] go.mod: Tidy Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4a8c450..17eb3eb 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/nspcc-dev/neo-go v0.101.1 github.com/stretchr/testify v1.8.3 go.uber.org/zap v1.24.0 + google.golang.org/grpc v1.55.0 ) require ( @@ -50,7 +51,6 @@ require ( golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) From e6b662cfa63bc6a7e0fc1690da68566ef84cc299 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 30 May 2023 15:48:19 +0300 Subject: [PATCH 016/323] [#75] Add `make` targets `policy` and `docker/%` Signed-off-by: Anton Nikiforov --- Dockerfile | 4 ++++ Makefile | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb6b420 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM golang:1.19 + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-11-jre -y +WORKDIR /work diff --git a/Makefile b/Makefile index 3210743..e149de9 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ #!/usr/bin/make -f +ANTLR_VERSION="4.13.0" + # Run tests test: @go test ./... -cover @@ -29,6 +31,19 @@ format: @echo "⇒ Processing goimports check" @goimports -w ./ +policy: + @wget -q https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar -O antlr4-tool.jar + @java -Xmx500M -cp "`pwd`/antlr4-tool.jar" "org.antlr.v4.Tool" -o `pwd`/netmap/parser/ -Dlanguage=Go -no-listener -visitor `pwd`/netmap/parser/Query.g4 `pwd`/netmap/parser/QueryLexer.g4 + +# Run `make %` in truecloudlab/frostfs-sdk-go container(Golang+Java) +docker/%: + @docker build -t truecloudlab/frostfs-sdk-go --platform linux/amd64 . > /dev/null + @docker run --rm -t \ + -v `pwd`:/work \ + -u "$$(id -u):$$(id -g)" \ + --env HOME=/work \ + truecloudlab/frostfs-sdk-go make $* + # Show this help prompt help: @echo ' Usage:' From 0f7455ff7a36a6e24e98798b35ec31946a5ee80d Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 1 Jun 2023 10:26:07 +0300 Subject: [PATCH 017/323] [#75] Update antlr4 version to 4.13.0 Signed-off-by: Anton Nikiforov --- go.mod | 2 +- go.sum | 4 +- netmap/parser/query_base_visitor.go | 4 +- netmap/parser/query_lexer.go | 49 +- netmap/parser/query_parser.go | 800 ++++++++++++++++------------ netmap/parser/query_visitor.go | 4 +- netmap/policy.go | 2 +- 7 files changed, 483 insertions(+), 382 deletions(-) diff --git a/go.mod b/go.mod index 17eb3eb..d4b330d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/hrw v1.2.0 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 + github.com/antlr4-go/antlr/v4 v4.13.0 github.com/google/uuid v1.3.0 github.com/hashicorp/golang-lru/v2 v2.0.2 github.com/mr-tron/base58 v1.2.0 diff --git a/go.sum b/go.sum index 8bc61dc..7d360f7 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGn github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 h1:goHVqTbFX3AIo0tzGr14pgfAW2ZfPChKO21Z9MGf/gk= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= diff --git a/netmap/parser/query_base_visitor.go b/netmap/parser/query_base_visitor.go index 235fd96..123302c 100644 --- a/netmap/parser/query_base_visitor.go +++ b/netmap/parser/query_base_visitor.go @@ -1,8 +1,8 @@ -// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT. package parser // Query -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" type BaseQueryVisitor struct { *antlr.BaseParseTreeVisitor diff --git a/netmap/parser/query_lexer.go b/netmap/parser/query_lexer.go index 7c24aae..17b2b35 100644 --- a/netmap/parser/query_lexer.go +++ b/netmap/parser/query_lexer.go @@ -1,13 +1,12 @@ -// Code generated from QueryLexer.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from /work/netmap/parser/QueryLexer.g4 by ANTLR 4.13.0. DO NOT EDIT. package parser import ( "fmt" + "github.com/antlr4-go/antlr/v4" "sync" "unicode" - - "github.com/antlr/antlr4/runtime/Go/antlr/v4" ) // Suppress unused import error @@ -22,45 +21,45 @@ type QueryLexer struct { // TODO: EOF string } -var querylexerLexerStaticData struct { +var QueryLexerLexerStaticData struct { once sync.Once serializedATN []int32 - channelNames []string - modeNames []string - literalNames []string - symbolicNames []string - ruleNames []string - predictionContextCache *antlr.PredictionContextCache + ChannelNames []string + ModeNames []string + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache atn *antlr.ATN decisionToDFA []*antlr.DFA } func querylexerLexerInit() { - staticData := &querylexerLexerStaticData - staticData.channelNames = []string{ + staticData := &QueryLexerLexerStaticData + staticData.ChannelNames = []string{ "DEFAULT_TOKEN_CHANNEL", "HIDDEN", } - staticData.modeNames = []string{ + staticData.ModeNames = []string{ "DEFAULT_MODE", } - staticData.literalNames = []string{ + staticData.LiteralNames = []string{ "", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'", "", "", "'0'", } - staticData.symbolicNames = []string{ + staticData.SymbolicNames = []string{ "", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", } - staticData.ruleNames = []string{ + staticData.RuleNames = []string{ "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", "WS", } - staticData.predictionContextCache = antlr.NewPredictionContextCache() + staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ 4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, @@ -166,7 +165,7 @@ func querylexerLexerInit() { // NewQueryLexer(). You can call this function if you wish to initialize the static state ahead // of time. func QueryLexerInit() { - staticData := &querylexerLexerStaticData + staticData := &QueryLexerLexerStaticData staticData.once.Do(querylexerLexerInit) } @@ -175,13 +174,13 @@ func NewQueryLexer(input antlr.CharStream) *QueryLexer { QueryLexerInit() l := new(QueryLexer) l.BaseLexer = antlr.NewBaseLexer(input) - staticData := &querylexerLexerStaticData - l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) - l.channelNames = staticData.channelNames - l.modeNames = staticData.modeNames - l.RuleNames = staticData.ruleNames - l.LiteralNames = staticData.literalNames - l.SymbolicNames = staticData.symbolicNames + staticData := &QueryLexerLexerStaticData + l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + l.channelNames = staticData.ChannelNames + l.modeNames = staticData.ModeNames + l.RuleNames = staticData.RuleNames + l.LiteralNames = staticData.LiteralNames + l.SymbolicNames = staticData.SymbolicNames l.GrammarFileName = "QueryLexer.g4" // TODO: l.EOF = antlr.TokenEOF diff --git a/netmap/parser/query_parser.go b/netmap/parser/query_parser.go index 08d40b8..1909b55 100644 --- a/netmap/parser/query_parser.go +++ b/netmap/parser/query_parser.go @@ -1,4 +1,4 @@ -// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT. package parser // Query @@ -7,7 +7,7 @@ import ( "strconv" "sync" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + "github.com/antlr4-go/antlr/v4" ) // Suppress unused import errors @@ -19,35 +19,35 @@ type Query struct { *antlr.BaseParser } -var queryParserStaticData struct { +var QueryParserStaticData struct { once sync.Once serializedATN []int32 - literalNames []string - symbolicNames []string - ruleNames []string - predictionContextCache *antlr.PredictionContextCache + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache atn *antlr.ATN decisionToDFA []*antlr.DFA } func queryParserInit() { - staticData := &queryParserStaticData - staticData.literalNames = []string{ + staticData := &QueryParserStaticData + staticData.LiteralNames = []string{ "", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'", "", "", "'0'", } - staticData.symbolicNames = []string{ + staticData.SymbolicNames = []string{ "", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", } - staticData.ruleNames = []string{ + staticData.RuleNames = []string{ "policy", "repStmt", "cbfStmt", "selectStmt", "clause", "filterExpr", "filterStmt", "expr", "filterKey", "filterValue", "number", "keyword", "ident", "identWC", } - staticData.predictionContextCache = antlr.NewPredictionContextCache() + staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ 4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, @@ -119,7 +119,7 @@ func queryParserInit() { // NewQuery(). You can call this function if you wish to initialize the static state ahead // of time. func QueryInit() { - staticData := &queryParserStaticData + staticData := &QueryParserStaticData staticData.once.Do(queryParserInit) } @@ -128,11 +128,11 @@ func NewQuery(input antlr.TokenStream) *Query { QueryInit() this := new(Query) this.BaseParser = antlr.NewBaseParser(input) - staticData := &queryParserStaticData - this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) - this.RuleNames = staticData.ruleNames - this.LiteralNames = staticData.literalNames - this.SymbolicNames = staticData.symbolicNames + staticData := &QueryParserStaticData + this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + this.RuleNames = staticData.RuleNames + this.LiteralNames = staticData.LiteralNames + this.SymbolicNames = staticData.SymbolicNames this.GrammarFileName = "Query.g4" return this @@ -204,23 +204,28 @@ type IPolicyContext interface { } type PolicyContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyPolicyContext() *PolicyContext { var p = new(PolicyContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_policy return p } +func InitEmptyPolicyContext(p *PolicyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_policy +} + func (*PolicyContext) IsPolicyContext() {} func NewPolicyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PolicyContext { var p = new(PolicyContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_policy @@ -392,32 +397,16 @@ func (s *PolicyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) Policy() (localctx IPolicyContext) { - this := p - _ = this - localctx = NewPolicyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 0, QueryRULE_policy) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(29) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for ok := true; ok; ok = _la == QueryREP { @@ -428,10 +417,16 @@ func (p *Query) Policy() (localctx IPolicyContext) { p.SetState(31) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } p.SetState(34) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == QueryCBF { @@ -443,6 +438,9 @@ func (p *Query) Policy() (localctx IPolicyContext) { } p.SetState(39) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == QuerySELECT { @@ -453,10 +451,16 @@ func (p *Query) Policy() (localctx IPolicyContext) { p.SetState(41) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } p.SetState(45) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == QueryFILTER { @@ -467,14 +471,31 @@ func (p *Query) Policy() (localctx IPolicyContext) { p.SetState(47) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(48) p.Match(QueryEOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IRepStmtContext is an interface to support dynamic dispatch. @@ -507,7 +528,7 @@ type IRepStmtContext interface { } type RepStmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser Count antlr.Token Selector IIdentContext @@ -515,17 +536,22 @@ type RepStmtContext struct { func NewEmptyRepStmtContext() *RepStmtContext { var p = new(RepStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_repStmt return p } +func InitEmptyRepStmtContext(p *RepStmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_repStmt +} + func (*RepStmtContext) IsRepStmtContext() {} func NewRepStmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RepStmtContext { var p = new(RepStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_repStmt @@ -590,33 +616,18 @@ func (s *RepStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) RepStmt() (localctx IRepStmtContext) { - this := p - _ = this - localctx = NewRepStmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 2, QueryRULE_repStmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(50) p.Match(QueryREP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(51) @@ -624,15 +635,26 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { var _m = p.Match(QueryNUMBER1) localctx.(*RepStmtContext).Count = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(54) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == QueryIN { { p.SetState(52) p.Match(QueryIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(53) @@ -644,7 +666,17 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICbfStmtContext is an interface to support dynamic dispatch. @@ -669,24 +701,29 @@ type ICbfStmtContext interface { } type CbfStmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser BackupFactor antlr.Token } func NewEmptyCbfStmtContext() *CbfStmtContext { var p = new(CbfStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_cbfStmt return p } +func InitEmptyCbfStmtContext(p *CbfStmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_cbfStmt +} + func (*CbfStmtContext) IsCbfStmtContext() {} func NewCbfStmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CbfStmtContext { var p = new(CbfStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_cbfStmt @@ -727,32 +764,16 @@ func (s *CbfStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) CbfStmt() (localctx ICbfStmtContext) { - this := p - _ = this - localctx = NewCbfStmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 4, QueryRULE_cbfStmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(56) p.Match(QueryCBF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(57) @@ -760,9 +781,23 @@ func (p *Query) CbfStmt() (localctx ICbfStmtContext) { var _m = p.Match(QueryNUMBER1) localctx.(*CbfStmtContext).BackupFactor = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISelectStmtContext is an interface to support dynamic dispatch. @@ -812,7 +847,7 @@ type ISelectStmtContext interface { } type SelectStmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser Count antlr.Token Bucket IIdentContext @@ -822,17 +857,22 @@ type SelectStmtContext struct { func NewEmptySelectStmtContext() *SelectStmtContext { var p = new(SelectStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_selectStmt return p } +func InitEmptySelectStmtContext(p *SelectStmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_selectStmt +} + func (*SelectStmtContext) IsSelectStmtContext() {} func NewSelectStmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelectStmtContext { var p = new(SelectStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_selectStmt @@ -970,33 +1010,18 @@ func (s *SelectStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) SelectStmt() (localctx ISelectStmtContext) { - this := p - _ = this - localctx = NewSelectStmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 6, QueryRULE_selectStmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(59) p.Match(QuerySELECT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(60) @@ -1004,18 +1029,32 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { var _m = p.Match(QueryNUMBER1) localctx.(*SelectStmtContext).Count = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(66) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == QueryIN { { p.SetState(61) p.Match(QueryIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(63) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT { @@ -1037,6 +1076,10 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { { p.SetState(68) p.Match(QueryFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(69) @@ -1047,12 +1090,19 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } p.SetState(72) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == QueryAS { { p.SetState(70) p.Match(QueryAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(71) @@ -1064,7 +1114,17 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IClauseContext is an interface to support dynamic dispatch. @@ -1083,23 +1143,28 @@ type IClauseContext interface { } type ClauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyClauseContext() *ClauseContext { var p = new(ClauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_clause return p } +func InitEmptyClauseContext(p *ClauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_clause +} + func (*ClauseContext) IsClauseContext() {} func NewClauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ClauseContext { var p = new(ClauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_clause @@ -1136,29 +1201,10 @@ func (s *ClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) Clause() (localctx IClauseContext) { - this := p - _ = this - localctx = NewClauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 8, QueryRULE_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(74) @@ -1172,7 +1218,17 @@ func (p *Query) Clause() (localctx IClauseContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFilterExprContext is an interface to support dynamic dispatch. @@ -1220,7 +1276,7 @@ type IFilterExprContext interface { } type FilterExprContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser F1 IFilterExprContext Inner IFilterExprContext @@ -1230,17 +1286,22 @@ type FilterExprContext struct { func NewEmptyFilterExprContext() *FilterExprContext { var p = new(FilterExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_filterExpr return p } +func InitEmptyFilterExprContext(p *FilterExprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_filterExpr +} + func (*FilterExprContext) IsFilterExprContext() {} func NewFilterExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FilterExprContext { var p = new(FilterExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_filterExpr @@ -1362,44 +1423,32 @@ func (p *Query) FilterExpr() (localctx IFilterExprContext) { } func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { - this := p - _ = this - var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() + _parentState := p.GetState() localctx = NewFilterExprContext(p, p.GetParserRuleContext(), _parentState) var _prevctx IFilterExprContext = localctx var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. _startState := 10 p.EnterRecursionRule(localctx, 10, QueryRULE_filterExpr, _p) - - defer func() { - p.UnrollRecursionContexts(_parentctx) - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) p.SetState(82) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case QueryL_PAREN: { p.SetState(77) p.Match(QueryL_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(78) @@ -1411,6 +1460,10 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { { p.SetState(79) p.Match(QueryR_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING: @@ -1420,13 +1473,19 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) p.SetState(92) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { if p.GetParseListeners() != nil { @@ -1435,7 +1494,11 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { _prevctx = localctx p.SetState(90) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 9, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 9, p.GetParserRuleContext()) { case 1: localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx @@ -1443,7 +1506,8 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { p.SetState(84) if !(p.Precpred(p.GetParserRuleContext(), 4)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) + goto errorExit } { p.SetState(85) @@ -1451,6 +1515,10 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { var _m = p.Match(QueryAND_OP) localctx.(*FilterExprContext).Op = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(86) @@ -1467,7 +1535,8 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { p.SetState(87) if !(p.Precpred(p.GetParserRuleContext(), 3)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) + goto errorExit } { p.SetState(88) @@ -1475,6 +1544,10 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { var _m = p.Match(QueryOR_OP) localctx.(*FilterExprContext).Op = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(89) @@ -1484,15 +1557,33 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx.(*FilterExprContext).F2 = _x } + case antlr.ATNInvalidAltNumber: + goto errorExit } } p.SetState(94) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.UnrollRecursionContexts(_parentctx) return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFilterStmtContext is an interface to support dynamic dispatch. @@ -1525,7 +1616,7 @@ type IFilterStmtContext interface { } type FilterStmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser Expr IFilterExprContext Name IIdentContext @@ -1533,17 +1624,22 @@ type FilterStmtContext struct { func NewEmptyFilterStmtContext() *FilterStmtContext { var p = new(FilterStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_filterStmt return p } +func InitEmptyFilterStmtContext(p *FilterStmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_filterStmt +} + func (*FilterStmtContext) IsFilterStmtContext() {} func NewFilterStmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FilterStmtContext { var p = new(FilterStmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_filterStmt @@ -1620,32 +1716,16 @@ func (s *FilterStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) FilterStmt() (localctx IFilterStmtContext) { - this := p - _ = this - localctx = NewFilterStmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 12, QueryRULE_filterStmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(95) p.Match(QueryFILTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(96) @@ -1657,6 +1737,10 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { { p.SetState(97) p.Match(QueryAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(98) @@ -1666,7 +1750,17 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { localctx.(*FilterStmtContext).Name = _x } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IExprContext is an interface to support dynamic dispatch. @@ -1706,7 +1800,7 @@ type IExprContext interface { } type ExprContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser Filter IIdentContext Key IFilterKeyContext @@ -1715,17 +1809,22 @@ type ExprContext struct { func NewEmptyExprContext() *ExprContext { var p = new(ExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_expr return p } +func InitEmptyExprContext(p *ExprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_expr +} + func (*ExprContext) IsExprContext() {} func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprContext { var p = new(ExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_expr @@ -1822,30 +1921,13 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) Expr() (localctx IExprContext) { - this := p - _ = this - localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 14, QueryRULE_expr) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.SetState(106) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case QueryAT: @@ -1853,6 +1935,10 @@ func (p *Query) Expr() (localctx IExprContext) { { p.SetState(100) p.Match(QueryAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(101) @@ -1874,6 +1960,10 @@ func (p *Query) Expr() (localctx IExprContext) { { p.SetState(103) p.Match(QuerySIMPLE_OP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(104) @@ -1884,10 +1974,21 @@ func (p *Query) Expr() (localctx IExprContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFilterKeyContext is an interface to support dynamic dispatch. @@ -1906,23 +2007,28 @@ type IFilterKeyContext interface { } type FilterKeyContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFilterKeyContext() *FilterKeyContext { var p = new(FilterKeyContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_filterKey return p } +func InitEmptyFilterKeyContext(p *FilterKeyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_filterKey +} + func (*FilterKeyContext) IsFilterKeyContext() {} func NewFilterKeyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FilterKeyContext { var p = new(FilterKeyContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_filterKey @@ -1971,30 +2077,13 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) FilterKey() (localctx IFilterKeyContext) { - this := p - _ = this - localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 16, QueryRULE_filterKey) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.SetState(110) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: @@ -2009,13 +2098,28 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) { { p.SetState(109) p.Match(QuerySTRING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFilterValueContext is an interface to support dynamic dispatch. @@ -2035,23 +2139,28 @@ type IFilterValueContext interface { } type FilterValueContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFilterValueContext() *FilterValueContext { var p = new(FilterValueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_filterValue return p } +func InitEmptyFilterValueContext(p *FilterValueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_filterValue +} + func (*FilterValueContext) IsFilterValueContext() {} func NewFilterValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FilterValueContext { var p = new(FilterValueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_filterValue @@ -2116,30 +2225,13 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } func (p *Query) FilterValue() (localctx IFilterValueContext) { - this := p - _ = this - localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 18, QueryRULE_filterValue) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.SetState(115) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: @@ -2161,13 +2253,28 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) { { p.SetState(114) p.Match(QuerySTRING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // INumberContext is an interface to support dynamic dispatch. @@ -2186,23 +2293,28 @@ type INumberContext interface { } type NumberContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyNumberContext() *NumberContext { var p = new(NumberContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_number return p } +func InitEmptyNumberContext(p *NumberContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_number +} + func (*NumberContext) IsNumberContext() {} func NewNumberContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NumberContext { var p = new(NumberContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_number @@ -2239,29 +2351,10 @@ func (s *NumberContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) Number() (localctx INumberContext) { - this := p - _ = this - localctx = NewNumberContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 20, QueryRULE_number) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(117) @@ -2275,7 +2368,17 @@ func (p *Query) Number() (localctx INumberContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IKeywordContext is an interface to support dynamic dispatch. @@ -2298,23 +2401,28 @@ type IKeywordContext interface { } type KeywordContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyKeywordContext() *KeywordContext { var p = new(KeywordContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_keyword return p } +func InitEmptyKeywordContext(p *KeywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_keyword +} + func (*KeywordContext) IsKeywordContext() {} func NewKeywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeywordContext { var p = new(KeywordContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_keyword @@ -2367,29 +2475,10 @@ func (s *KeywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) Keyword() (localctx IKeywordContext) { - this := p - _ = this - localctx = NewKeywordContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 22, QueryRULE_keyword) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(119) @@ -2403,7 +2492,17 @@ func (p *Query) Keyword() (localctx IKeywordContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IIdentContext is an interface to support dynamic dispatch. @@ -2422,23 +2521,28 @@ type IIdentContext interface { } type IdentContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyIdentContext() *IdentContext { var p = new(IdentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_ident return p } +func InitEmptyIdentContext(p *IdentContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_ident +} + func (*IdentContext) IsIdentContext() {} func NewIdentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IdentContext { var p = new(IdentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_ident @@ -2487,30 +2591,13 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) Ident() (localctx IIdentContext) { - this := p - _ = this - localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 24, QueryRULE_ident) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.SetState(123) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER: @@ -2525,13 +2612,28 @@ func (p *Query) Ident() (localctx IIdentContext) { { p.SetState(122) p.Match(QueryIDENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IIdentWCContext is an interface to support dynamic dispatch. @@ -2550,23 +2652,28 @@ type IIdentWCContext interface { } type IdentWCContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyIdentWCContext() *IdentWCContext { var p = new(IdentWCContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = QueryRULE_identWC return p } +func InitEmptyIdentWCContext(p *IdentWCContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_identWC +} + func (*IdentWCContext) IsIdentWCContext() {} func NewIdentWCContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IdentWCContext { var p = new(IdentWCContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = QueryRULE_identWC @@ -2615,30 +2722,13 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } func (p *Query) IdentWC() (localctx IIdentWCContext) { - this := p - _ = this - localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 26, QueryRULE_identWC) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.SetState(127) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: @@ -2653,13 +2743,28 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) { { p.SetState(126) p.Match(QueryWILDCARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } func (p *Query) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { @@ -2677,9 +2782,6 @@ func (p *Query) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bo } func (p *Query) FilterExpr_Sempred(localctx antlr.RuleContext, predIndex int) bool { - this := p - _ = this - switch predIndex { case 0: return p.Precpred(p.GetParserRuleContext(), 4) diff --git a/netmap/parser/query_visitor.go b/netmap/parser/query_visitor.go index 06c0e58..edf8649 100644 --- a/netmap/parser/query_visitor.go +++ b/netmap/parser/query_visitor.go @@ -1,8 +1,8 @@ -// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT. package parser // Query -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" // A complete Visitor for a parse tree produced by Query. type QueryVisitor interface { diff --git a/netmap/policy.go b/netmap/policy.go index b2dd766..d5b265f 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/parser" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + "github.com/antlr4-go/antlr/v4" ) // PlacementPolicy declares policy to store objects in the FrostFS container. From 030ff2f122b1db83af4ae2b58c2b0e5175424e84 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 2 Jun 2023 14:50:04 +0300 Subject: [PATCH 018/323] [#87] netmap: Add benchmark for ContainerNodes() Signed-off-by: Evgenii Stratonikov --- netmap/bench_test.go | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 netmap/bench_test.go diff --git a/netmap/bench_test.go b/netmap/bench_test.go new file mode 100644 index 0000000..9793df6 --- /dev/null +++ b/netmap/bench_test.go @@ -0,0 +1,59 @@ +package netmap + +import ( + "testing" + + cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" + "github.com/stretchr/testify/require" +) + +func BenchmarkNetmap_ContainerNodes(b *testing.B) { + nodes := []NodeInfo{ + nodeInfoFromAttributes("Country", "Russia", "Order", "1"), + nodeInfoFromAttributes("Country", "Germany", "Order", "2"), + nodeInfoFromAttributes("Country", "Russia", "Order", "3"), + nodeInfoFromAttributes("Country", "France", "Order", "4"), + nodeInfoFromAttributes("Country", "France", "Order", "5"), + nodeInfoFromAttributes("Country", "Russia", "Order", "6"), + nodeInfoFromAttributes("Country", "Russia", "Order", "7"), + nodeInfoFromAttributes("Country", "Germany", "Order", "8"), + nodeInfoFromAttributes("Country", "Germany", "Order", "9"), + nodeInfoFromAttributes("Country", "Russia", "Order", "10"), + nodeInfoFromAttributes("Country", "China", "Order", "11"), + nodeInfoFromAttributes("Country", "China", "Order", "12"), + nodeInfoFromAttributes("Country", "Finland", "Order", "13"), + nodeInfoFromAttributes("Country", "Finland", "Order", "14"), + nodeInfoFromAttributes("Country", "España", "Order", "15"), + nodeInfoFromAttributes("Country", "España", "Order", "16"), + } + + var nm NetMap + nm.SetNodes(nodes) + + policies := []string{ + `REP 2`, + `REP 2 IN X CBF 2 SELECT 2 FROM * AS X`, + } + cnr := cidtest.ID() + + pivot := make([]byte, 32) + cnr.Encode(pivot) + + for i := range policies { + b.Run(policies[i], func(b *testing.B) { + var p PlacementPolicy + require.NoError(b, p.DecodeString(policies[i])) + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + _, err := nm.ContainerNodes(p, pivot) + if err != nil { + b.Fatal(err) + } + } + + }) + } +} From ec59ebfd8826ff1dc9c13998e2a6796c93364005 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 2 Jun 2023 14:51:51 +0300 Subject: [PATCH 019/323] [#87] go.mod: Update hrw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` │ old │ new │ │ sec/op │ sec/op vs base │ Netmap_ContainerNodes/REP_2-8 13.07µ ± 12% 11.03µ ± 12% -15.63% (p=0.003 n=10) Netmap_ContainerNodes/REP_2_IN_X_CBF_2_SELECT_2_FROM_*_AS_X-8 11.383µ ± 9% 9.970µ ± 19% -12.42% (p=0.005 n=10) geomean 12.20µ 10.49µ -14.04% │ old │ new │ │ B/op │ B/op vs base │ Netmap_ContainerNodes/REP_2-8 10.203Ki ± 0% 7.711Ki ± 0% -24.43% (p=0.000 n=10) Netmap_ContainerNodes/REP_2_IN_X_CBF_2_SELECT_2_FROM_*_AS_X-8 9.641Ki ± 0% 7.148Ki ± 0% -25.85% (p=0.000 n=10) geomean 9.918Ki 7.424Ki -25.14% │ old │ new │ │ allocs/op │ allocs/op vs base │ Netmap_ContainerNodes/REP_2-8 216.0 ± 0% 131.0 ± 0% -39.35% (p=0.000 n=10) Netmap_ContainerNodes/REP_2_IN_X_CBF_2_SELECT_2_FROM_*_AS_X-8 215.0 ± 0% 130.0 ± 0% -39.53% (p=0.000 n=10) geomean 215.5 130.5 -39.44% ``` Signed-off-by: Evgenii Stratonikov --- go.mod | 4 ++-- go.sum | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index d4b330d..299395f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41 git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb - git.frostfs.info/TrueCloudLab/hrw v1.2.0 + git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 github.com/antlr4-go/antlr/v4 v4.13.0 github.com/google/uuid v1.3.0 @@ -33,7 +33,7 @@ require ( github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb // indirect github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/twmb/murmur3 v1.1.8 // indirect go.opentelemetry.io/otel v1.15.1 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect diff --git a/go.sum b/go.sum index 7d360f7..cccb135 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02f git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= -git.frostfs.info/TrueCloudLab/hrw v1.2.0 h1:KvAES7xIqmQBGd2q8KanNosD9+4BhU/zqD5Kt5KSflk= -git.frostfs.info/TrueCloudLab/hrw v1.2.0/go.mod h1:mq2sbvYfO+BB6iFZwYBkgC0yc6mJNx+qZi4jW918m+Y= +git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc= +git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA= @@ -355,7 +355,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -370,6 +369,8 @@ github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2K github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= +github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= From 4f48f6c9e0e6c06dd5ee63bba246a1bd4354abc2 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 24 May 2023 12:50:13 +0300 Subject: [PATCH 020/323] [#78] netmap: Add new keywords NOT and UNIQUE * Add the rule for NOT operation to the policy parser grammar * Regenerate query parse * Implement NOT in filter * Add unit-tests Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- .gitignore | 3 + go.mod | 7 +- go.sum | 48 +---- netmap/filter.go | 9 +- netmap/parser/Query.g4 | 3 +- netmap/parser/Query.interp | 4 +- netmap/parser/Query.tokens | 76 ++++---- netmap/parser/QueryLexer.g4 | 1 + netmap/parser/QueryLexer.interp | 5 +- netmap/parser/QueryLexer.tokens | 76 ++++---- netmap/parser/query_base_visitor.go | 2 - netmap/parser/query_lexer.go | 238 ++++++++++++------------ netmap/parser/query_parser.go | 278 ++++++++++++++++------------ netmap/parser/query_visitor.go | 2 - netmap/policy.go | 37 +++- netmap/policy_test.go | 4 + netmap/selector_test.go | 51 +++++ 17 files changed, 468 insertions(+), 376 deletions(-) diff --git a/.gitignore b/.gitignore index 3f5de01..b4fc404 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ vendor/ # coverage coverage.txt coverage.html + +# antlr tool jar +antlr-*.jar \ No newline at end of file diff --git a/go.mod b/go.mod index 299395f..d3d7721 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.19 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41 + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 @@ -20,14 +20,10 @@ require ( require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 // indirect git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect github.com/hashicorp/golang-lru v0.6.0 // indirect github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb // indirect @@ -43,6 +39,7 @@ require ( go.opentelemetry.io/otel/trace v1.15.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.9.0 // indirect + go.uber.org/goleak v1.2.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.9.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect diff --git a/go.sum b/go.sum index cccb135..1d4eb8e 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41 h1:xtGsOUX8Rz0hwWIFa148URysWuD4nRHspPNbYAUc1tg= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41/go.mod h1:6wEpMfSwD5xNtQYYVHWWTHwpYuvyumyntZEzILBIXUo= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac h1:a6/Zc5BejflmguShwbllgJdEehnM9gshkLrLbKQHCU0= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= @@ -49,7 +49,6 @@ github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1 github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I= github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs= @@ -83,10 +82,7 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -96,11 +92,7 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn 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= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -115,7 +107,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= @@ -137,18 +128,11 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -217,9 +201,6 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -390,29 +371,14 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= -go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0= -go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI= -go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA= -go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= -go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -501,7 +467,6 @@ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -514,7 +479,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -577,9 +541,7 @@ golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -596,7 +558,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= @@ -704,7 +665,6 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -721,9 +681,7 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/netmap/filter.go b/netmap/filter.go index 7b1abb1..71e101d 100644 --- a/netmap/filter.go +++ b/netmap/filter.go @@ -39,7 +39,7 @@ func (c *context) processFilter(f netmap.Filter, top bool) error { inner := f.GetFilters() switch op := f.GetOp(); op { - case netmap.AND, netmap.OR: + case netmap.AND, netmap.OR, netmap.NOT: for i := range inner { if err := c.processFilter(inner[i], false); err != nil { return fmt.Errorf("process inner filter #%d: %w", i, err) @@ -79,6 +79,13 @@ func (c *context) processFilter(f netmap.Filter, top bool) error { // and missing node properties are considered as a regular fail. func (c *context) match(f *netmap.Filter, b NodeInfo) bool { switch f.GetOp() { + case netmap.NOT: + inner := f.GetFilters() + fSub := &inner[0] + if name := inner[0].GetName(); name != "" { + fSub = c.processedFilters[name] + } + return !c.match(fSub, b) case netmap.AND, netmap.OR: inner := f.GetFilters() for i := range inner { diff --git a/netmap/parser/Query.g4 b/netmap/parser/Query.g4 index 52fcb4f..a52746a 100644 --- a/netmap/parser/Query.g4 +++ b/netmap/parser/Query.g4 @@ -22,7 +22,8 @@ selectStmt: clause: CLAUSE_SAME | CLAUSE_DISTINCT; // nodes from distinct buckets filterExpr: - F1 = filterExpr Op = AND_OP F2 = filterExpr + Op = NOT_OP '(' F1 = filterExpr ')' + | F1 = filterExpr Op = AND_OP F2 = filterExpr | F1 = filterExpr Op = OR_OP F2 = filterExpr | '(' Inner = filterExpr ')' | expr diff --git a/netmap/parser/Query.interp b/netmap/parser/Query.interp index 298ddae..60db0a9 100644 --- a/netmap/parser/Query.interp +++ b/netmap/parser/Query.interp @@ -1,5 +1,6 @@ token literal names: null +'NOT' 'AND' 'OR' null @@ -24,6 +25,7 @@ null token symbolic names: null +NOT_OP AND_OP OR_OP SIMPLE_OP @@ -64,4 +66,4 @@ identWC atn: -[4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 83, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 91, 8, 5, 10, 5, 12, 5, 94, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 107, 8, 7, 1, 8, 1, 8, 3, 8, 111, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 116, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 124, 8, 12, 1, 13, 1, 13, 3, 13, 128, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 12, 13, 1, 0, 18, 19, 2, 0, 4, 6, 8, 10, 132, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 95, 1, 0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 115, 1, 0, 0, 0, 20, 117, 1, 0, 0, 0, 22, 119, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 127, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 4, 0, 0, 51, 54, 5, 18, 0, 0, 52, 53, 5, 5, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 7, 0, 0, 57, 58, 5, 18, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 8, 0, 0, 60, 66, 5, 18, 0, 0, 61, 63, 5, 5, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 9, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5, 6, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 14, 0, 0, 78, 79, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80, 83, 1, 0, 0, 0, 81, 83, 3, 14, 7, 0, 82, 76, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 92, 1, 0, 0, 0, 84, 85, 10, 4, 0, 0, 85, 86, 5, 1, 0, 0, 86, 91, 3, 10, 5, 5, 87, 88, 10, 3, 0, 0, 88, 89, 5, 2, 0, 0, 89, 91, 3, 10, 5, 4, 90, 84, 1, 0, 0, 0, 90, 87, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 95, 96, 5, 10, 0, 0, 96, 97, 3, 10, 5, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3, 24, 12, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 16, 0, 0, 101, 107, 3, 24, 12, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 3, 0, 0, 104, 105, 3, 18, 9, 0, 105, 107, 1, 0, 0, 0, 106, 100, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107, 15, 1, 0, 0, 0, 108, 111, 3, 24, 12, 0, 109, 111, 5, 20, 0, 0, 110, 108, 1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 17, 1, 0, 0, 0, 112, 116, 3, 24, 12, 0, 113, 116, 3, 20, 10, 0, 114, 116, 5, 20, 0, 0, 115, 112, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 19, 1, 0, 0, 0, 117, 118, 7, 1, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 7, 2, 0, 0, 120, 23, 1, 0, 0, 0, 121, 124, 3, 22, 11, 0, 122, 124, 5, 17, 0, 0, 123, 121, 1, 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 25, 1, 0, 0, 0, 125, 128, 3, 24, 12, 0, 126, 128, 5, 11, 0, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, 128, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 82, 90, 92, 106, 110, 115, 123, 127] \ No newline at end of file +[4, 1, 22, 135, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 112, 8, 7, 1, 8, 1, 8, 3, 8, 116, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 129, 8, 12, 1, 13, 1, 13, 3, 13, 133, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 13, 14, 1, 0, 19, 20, 2, 0, 5, 7, 9, 11, 138, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 87, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 115, 1, 0, 0, 0, 18, 120, 1, 0, 0, 0, 20, 122, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24, 128, 1, 0, 0, 0, 26, 132, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 5, 0, 0, 51, 54, 5, 19, 0, 0, 52, 53, 5, 6, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 8, 0, 0, 57, 58, 5, 19, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 66, 5, 19, 0, 0, 61, 63, 5, 6, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 10, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5, 7, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 1, 0, 0, 78, 79, 5, 15, 0, 0, 79, 80, 3, 10, 5, 0, 80, 81, 5, 16, 0, 0, 81, 88, 1, 0, 0, 0, 82, 83, 5, 15, 0, 0, 83, 84, 3, 10, 5, 0, 84, 85, 5, 16, 0, 0, 85, 88, 1, 0, 0, 0, 86, 88, 3, 14, 7, 0, 87, 76, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 87, 86, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 5, 2, 0, 0, 91, 96, 3, 10, 5, 5, 92, 93, 10, 3, 0, 0, 93, 94, 5, 3, 0, 0, 94, 96, 3, 10, 5, 4, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 11, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 3, 10, 5, 0, 102, 103, 5, 7, 0, 0, 103, 104, 3, 24, 12, 0, 104, 13, 1, 0, 0, 0, 105, 106, 5, 17, 0, 0, 106, 112, 3, 24, 12, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 4, 0, 0, 109, 110, 3, 18, 9, 0, 110, 112, 1, 0, 0, 0, 111, 105, 1, 0, 0, 0, 111, 107, 1, 0, 0, 0, 112, 15, 1, 0, 0, 0, 113, 116, 3, 24, 12, 0, 114, 116, 5, 21, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0, 0, 0, 117, 121, 3, 24, 12, 0, 118, 121, 3, 20, 10, 0, 119, 121, 5, 21, 0, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, 121, 19, 1, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 21, 1, 0, 0, 0, 124, 125, 7, 2, 0, 0, 125, 23, 1, 0, 0, 0, 126, 129, 3, 22, 11, 0, 127, 129, 5, 18, 0, 0, 128, 126, 1, 0, 0, 0, 128, 127, 1, 0, 0, 0, 129, 25, 1, 0, 0, 0, 130, 133, 3, 24, 12, 0, 131, 133, 5, 12, 0, 0, 132, 130, 1, 0, 0, 0, 132, 131, 1, 0, 0, 0, 133, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 87, 95, 97, 111, 115, 120, 128, 132] \ No newline at end of file diff --git a/netmap/parser/Query.tokens b/netmap/parser/Query.tokens index 7f5aee9..8fdec7d 100644 --- a/netmap/parser/Query.tokens +++ b/netmap/parser/Query.tokens @@ -1,37 +1,39 @@ -AND_OP=1 -OR_OP=2 -SIMPLE_OP=3 -REP=4 -IN=5 -AS=6 -CBF=7 -SELECT=8 -FROM=9 -FILTER=10 -WILDCARD=11 -CLAUSE_SAME=12 -CLAUSE_DISTINCT=13 -L_PAREN=14 -R_PAREN=15 -AT=16 -IDENT=17 -NUMBER1=18 -ZERO=19 -STRING=20 -WS=21 -'AND'=1 -'OR'=2 -'REP'=4 -'IN'=5 -'AS'=6 -'CBF'=7 -'SELECT'=8 -'FROM'=9 -'FILTER'=10 -'*'=11 -'SAME'=12 -'DISTINCT'=13 -'('=14 -')'=15 -'@'=16 -'0'=19 +NOT_OP=1 +AND_OP=2 +OR_OP=3 +SIMPLE_OP=4 +REP=5 +IN=6 +AS=7 +CBF=8 +SELECT=9 +FROM=10 +FILTER=11 +WILDCARD=12 +CLAUSE_SAME=13 +CLAUSE_DISTINCT=14 +L_PAREN=15 +R_PAREN=16 +AT=17 +IDENT=18 +NUMBER1=19 +ZERO=20 +STRING=21 +WS=22 +'NOT'=1 +'AND'=2 +'OR'=3 +'REP'=5 +'IN'=6 +'AS'=7 +'CBF'=8 +'SELECT'=9 +'FROM'=10 +'FILTER'=11 +'*'=12 +'SAME'=13 +'DISTINCT'=14 +'('=15 +')'=16 +'@'=17 +'0'=20 diff --git a/netmap/parser/QueryLexer.g4 b/netmap/parser/QueryLexer.g4 index 6c245b6..f32023c 100644 --- a/netmap/parser/QueryLexer.g4 +++ b/netmap/parser/QueryLexer.g4 @@ -1,5 +1,6 @@ lexer grammar QueryLexer; +NOT_OP : 'NOT'; AND_OP : 'AND'; OR_OP : 'OR'; SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE'; diff --git a/netmap/parser/QueryLexer.interp b/netmap/parser/QueryLexer.interp index 80a47ce..71b093c 100644 --- a/netmap/parser/QueryLexer.interp +++ b/netmap/parser/QueryLexer.interp @@ -1,5 +1,6 @@ token literal names: null +'NOT' 'AND' 'OR' null @@ -24,6 +25,7 @@ null token symbolic names: null +NOT_OP AND_OP OR_OP SIMPLE_OP @@ -47,6 +49,7 @@ STRING WS rule names: +NOT_OP AND_OP OR_OP SIMPLE_OP @@ -84,4 +87,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 77, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 5, 16, 137, 8, 16, 10, 16, 12, 16, 140, 9, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 148, 8, 19, 10, 19, 12, 19, 151, 9, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 158, 8, 21, 10, 21, 12, 21, 161, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 167, 8, 21, 10, 21, 12, 21, 170, 9, 21, 1, 21, 3, 21, 173, 8, 21, 1, 22, 1, 22, 1, 22, 3, 22, 178, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 4, 27, 193, 8, 27, 11, 27, 12, 27, 194, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 0, 39, 18, 41, 19, 43, 20, 45, 0, 47, 0, 49, 0, 51, 0, 53, 0, 55, 21, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 205, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 61, 1, 0, 0, 0, 5, 76, 1, 0, 0, 0, 7, 78, 1, 0, 0, 0, 9, 82, 1, 0, 0, 0, 11, 85, 1, 0, 0, 0, 13, 88, 1, 0, 0, 0, 15, 92, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 104, 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 118, 1, 0, 0, 0, 27, 127, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 133, 1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 145, 1, 0, 0, 0, 41, 152, 1, 0, 0, 0, 43, 172, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 179, 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 187, 1, 0, 0, 0, 53, 189, 1, 0, 0, 0, 55, 192, 1, 0, 0, 0, 57, 58, 5, 65, 0, 0, 58, 59, 5, 78, 0, 0, 59, 60, 5, 68, 0, 0, 60, 2, 1, 0, 0, 0, 61, 62, 5, 79, 0, 0, 62, 63, 5, 82, 0, 0, 63, 4, 1, 0, 0, 0, 64, 65, 5, 69, 0, 0, 65, 77, 5, 81, 0, 0, 66, 67, 5, 78, 0, 0, 67, 77, 5, 69, 0, 0, 68, 69, 5, 71, 0, 0, 69, 77, 5, 69, 0, 0, 70, 71, 5, 71, 0, 0, 71, 77, 5, 84, 0, 0, 72, 73, 5, 76, 0, 0, 73, 77, 5, 84, 0, 0, 74, 75, 5, 76, 0, 0, 75, 77, 5, 69, 0, 0, 76, 64, 1, 0, 0, 0, 76, 66, 1, 0, 0, 0, 76, 68, 1, 0, 0, 0, 76, 70, 1, 0, 0, 0, 76, 72, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 6, 1, 0, 0, 0, 78, 79, 5, 82, 0, 0, 79, 80, 5, 69, 0, 0, 80, 81, 5, 80, 0, 0, 81, 8, 1, 0, 0, 0, 82, 83, 5, 73, 0, 0, 83, 84, 5, 78, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 65, 0, 0, 86, 87, 5, 83, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 67, 0, 0, 89, 90, 5, 66, 0, 0, 90, 91, 5, 70, 0, 0, 91, 14, 1, 0, 0, 0, 92, 93, 5, 83, 0, 0, 93, 94, 5, 69, 0, 0, 94, 95, 5, 76, 0, 0, 95, 96, 5, 69, 0, 0, 96, 97, 5, 67, 0, 0, 97, 98, 5, 84, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 70, 0, 0, 100, 101, 5, 82, 0, 0, 101, 102, 5, 79, 0, 0, 102, 103, 5, 77, 0, 0, 103, 18, 1, 0, 0, 0, 104, 105, 5, 70, 0, 0, 105, 106, 5, 73, 0, 0, 106, 107, 5, 76, 0, 0, 107, 108, 5, 84, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 82, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 42, 0, 0, 112, 22, 1, 0, 0, 0, 113, 114, 5, 83, 0, 0, 114, 115, 5, 65, 0, 0, 115, 116, 5, 77, 0, 0, 116, 117, 5, 69, 0, 0, 117, 24, 1, 0, 0, 0, 118, 119, 5, 68, 0, 0, 119, 120, 5, 73, 0, 0, 120, 121, 5, 83, 0, 0, 121, 122, 5, 84, 0, 0, 122, 123, 5, 73, 0, 0, 123, 124, 5, 78, 0, 0, 124, 125, 5, 67, 0, 0, 125, 126, 5, 84, 0, 0, 126, 26, 1, 0, 0, 0, 127, 128, 5, 40, 0, 0, 128, 28, 1, 0, 0, 0, 129, 130, 5, 41, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 64, 0, 0, 132, 32, 1, 0, 0, 0, 133, 138, 3, 37, 18, 0, 134, 137, 3, 35, 17, 0, 135, 137, 3, 37, 18, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 140, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 34, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 141, 142, 7, 0, 0, 0, 142, 36, 1, 0, 0, 0, 143, 144, 7, 1, 0, 0, 144, 38, 1, 0, 0, 0, 145, 149, 7, 2, 0, 0, 146, 148, 3, 35, 17, 0, 147, 146, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 40, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, 152, 153, 5, 48, 0, 0, 153, 42, 1, 0, 0, 0, 154, 159, 5, 34, 0, 0, 155, 158, 3, 45, 22, 0, 156, 158, 3, 53, 26, 0, 157, 155, 1, 0, 0, 0, 157, 156, 1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 173, 5, 34, 0, 0, 163, 168, 5, 39, 0, 0, 164, 167, 3, 45, 22, 0, 165, 167, 3, 51, 25, 0, 166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 173, 5, 39, 0, 0, 172, 154, 1, 0, 0, 0, 172, 163, 1, 0, 0, 0, 173, 44, 1, 0, 0, 0, 174, 177, 5, 92, 0, 0, 175, 178, 7, 3, 0, 0, 176, 178, 3, 47, 23, 0, 177, 175, 1, 0, 0, 0, 177, 176, 1, 0, 0, 0, 178, 46, 1, 0, 0, 0, 179, 180, 5, 117, 0, 0, 180, 181, 3, 49, 24, 0, 181, 182, 3, 49, 24, 0, 182, 183, 3, 49, 24, 0, 183, 184, 3, 49, 24, 0, 184, 48, 1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 50, 1, 0, 0, 0, 187, 188, 8, 5, 0, 0, 188, 52, 1, 0, 0, 0, 189, 190, 8, 6, 0, 0, 190, 54, 1, 0, 0, 0, 191, 193, 7, 7, 0, 0, 192, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 27, 0, 0, 197, 56, 1, 0, 0, 0, 12, 0, 76, 136, 138, 149, 157, 159, 166, 168, 172, 177, 194, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 22, 204, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 83, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 5, 17, 143, 8, 17, 10, 17, 12, 17, 146, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 5, 20, 154, 8, 20, 10, 20, 12, 20, 157, 9, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 5, 22, 164, 8, 22, 10, 22, 12, 22, 167, 9, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 173, 8, 22, 10, 22, 12, 22, 176, 9, 22, 1, 22, 3, 22, 179, 8, 22, 1, 23, 1, 23, 1, 23, 3, 23, 184, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 4, 28, 199, 8, 28, 11, 28, 12, 28, 200, 1, 28, 1, 28, 0, 0, 29, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 0, 39, 0, 41, 19, 43, 20, 45, 21, 47, 0, 49, 0, 51, 0, 53, 0, 55, 0, 57, 22, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 211, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 1, 59, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0, 5, 67, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 84, 1, 0, 0, 0, 11, 88, 1, 0, 0, 0, 13, 91, 1, 0, 0, 0, 15, 94, 1, 0, 0, 0, 17, 98, 1, 0, 0, 0, 19, 105, 1, 0, 0, 0, 21, 110, 1, 0, 0, 0, 23, 117, 1, 0, 0, 0, 25, 119, 1, 0, 0, 0, 27, 124, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 135, 1, 0, 0, 0, 33, 137, 1, 0, 0, 0, 35, 139, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 149, 1, 0, 0, 0, 41, 151, 1, 0, 0, 0, 43, 158, 1, 0, 0, 0, 45, 178, 1, 0, 0, 0, 47, 180, 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 193, 1, 0, 0, 0, 55, 195, 1, 0, 0, 0, 57, 198, 1, 0, 0, 0, 59, 60, 5, 78, 0, 0, 60, 61, 5, 79, 0, 0, 61, 62, 5, 84, 0, 0, 62, 2, 1, 0, 0, 0, 63, 64, 5, 65, 0, 0, 64, 65, 5, 78, 0, 0, 65, 66, 5, 68, 0, 0, 66, 4, 1, 0, 0, 0, 67, 68, 5, 79, 0, 0, 68, 69, 5, 82, 0, 0, 69, 6, 1, 0, 0, 0, 70, 71, 5, 69, 0, 0, 71, 83, 5, 81, 0, 0, 72, 73, 5, 78, 0, 0, 73, 83, 5, 69, 0, 0, 74, 75, 5, 71, 0, 0, 75, 83, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 83, 5, 84, 0, 0, 78, 79, 5, 76, 0, 0, 79, 83, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 83, 5, 69, 0, 0, 82, 70, 1, 0, 0, 0, 82, 72, 1, 0, 0, 0, 82, 74, 1, 0, 0, 0, 82, 76, 1, 0, 0, 0, 82, 78, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 8, 1, 0, 0, 0, 84, 85, 5, 82, 0, 0, 85, 86, 5, 69, 0, 0, 86, 87, 5, 80, 0, 0, 87, 10, 1, 0, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 78, 0, 0, 90, 12, 1, 0, 0, 0, 91, 92, 5, 65, 0, 0, 92, 93, 5, 83, 0, 0, 93, 14, 1, 0, 0, 0, 94, 95, 5, 67, 0, 0, 95, 96, 5, 66, 0, 0, 96, 97, 5, 70, 0, 0, 97, 16, 1, 0, 0, 0, 98, 99, 5, 83, 0, 0, 99, 100, 5, 69, 0, 0, 100, 101, 5, 76, 0, 0, 101, 102, 5, 69, 0, 0, 102, 103, 5, 67, 0, 0, 103, 104, 5, 84, 0, 0, 104, 18, 1, 0, 0, 0, 105, 106, 5, 70, 0, 0, 106, 107, 5, 82, 0, 0, 107, 108, 5, 79, 0, 0, 108, 109, 5, 77, 0, 0, 109, 20, 1, 0, 0, 0, 110, 111, 5, 70, 0, 0, 111, 112, 5, 73, 0, 0, 112, 113, 5, 76, 0, 0, 113, 114, 5, 84, 0, 0, 114, 115, 5, 69, 0, 0, 115, 116, 5, 82, 0, 0, 116, 22, 1, 0, 0, 0, 117, 118, 5, 42, 0, 0, 118, 24, 1, 0, 0, 0, 119, 120, 5, 83, 0, 0, 120, 121, 5, 65, 0, 0, 121, 122, 5, 77, 0, 0, 122, 123, 5, 69, 0, 0, 123, 26, 1, 0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 73, 0, 0, 126, 127, 5, 83, 0, 0, 127, 128, 5, 84, 0, 0, 128, 129, 5, 73, 0, 0, 129, 130, 5, 78, 0, 0, 130, 131, 5, 67, 0, 0, 131, 132, 5, 84, 0, 0, 132, 28, 1, 0, 0, 0, 133, 134, 5, 40, 0, 0, 134, 30, 1, 0, 0, 0, 135, 136, 5, 41, 0, 0, 136, 32, 1, 0, 0, 0, 137, 138, 5, 64, 0, 0, 138, 34, 1, 0, 0, 0, 139, 144, 3, 39, 19, 0, 140, 143, 3, 37, 18, 0, 141, 143, 3, 39, 19, 0, 142, 140, 1, 0, 0, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 36, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148, 7, 0, 0, 0, 148, 38, 1, 0, 0, 0, 149, 150, 7, 1, 0, 0, 150, 40, 1, 0, 0, 0, 151, 155, 7, 2, 0, 0, 152, 154, 3, 37, 18, 0, 153, 152, 1, 0, 0, 0, 154, 157, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 42, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 158, 159, 5, 48, 0, 0, 159, 44, 1, 0, 0, 0, 160, 165, 5, 34, 0, 0, 161, 164, 3, 47, 23, 0, 162, 164, 3, 55, 27, 0, 163, 161, 1, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 168, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 168, 179, 5, 34, 0, 0, 169, 174, 5, 39, 0, 0, 170, 173, 3, 47, 23, 0, 171, 173, 3, 53, 26, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 179, 5, 39, 0, 0, 178, 160, 1, 0, 0, 0, 178, 169, 1, 0, 0, 0, 179, 46, 1, 0, 0, 0, 180, 183, 5, 92, 0, 0, 181, 184, 7, 3, 0, 0, 182, 184, 3, 49, 24, 0, 183, 181, 1, 0, 0, 0, 183, 182, 1, 0, 0, 0, 184, 48, 1, 0, 0, 0, 185, 186, 5, 117, 0, 0, 186, 187, 3, 51, 25, 0, 187, 188, 3, 51, 25, 0, 188, 189, 3, 51, 25, 0, 189, 190, 3, 51, 25, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 4, 0, 0, 192, 52, 1, 0, 0, 0, 193, 194, 8, 5, 0, 0, 194, 54, 1, 0, 0, 0, 195, 196, 8, 6, 0, 0, 196, 56, 1, 0, 0, 0, 197, 199, 7, 7, 0, 0, 198, 197, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 203, 6, 28, 0, 0, 203, 58, 1, 0, 0, 0, 12, 0, 82, 142, 144, 155, 163, 165, 172, 174, 178, 183, 200, 1, 6, 0, 0] \ No newline at end of file diff --git a/netmap/parser/QueryLexer.tokens b/netmap/parser/QueryLexer.tokens index 7f5aee9..8fdec7d 100644 --- a/netmap/parser/QueryLexer.tokens +++ b/netmap/parser/QueryLexer.tokens @@ -1,37 +1,39 @@ -AND_OP=1 -OR_OP=2 -SIMPLE_OP=3 -REP=4 -IN=5 -AS=6 -CBF=7 -SELECT=8 -FROM=9 -FILTER=10 -WILDCARD=11 -CLAUSE_SAME=12 -CLAUSE_DISTINCT=13 -L_PAREN=14 -R_PAREN=15 -AT=16 -IDENT=17 -NUMBER1=18 -ZERO=19 -STRING=20 -WS=21 -'AND'=1 -'OR'=2 -'REP'=4 -'IN'=5 -'AS'=6 -'CBF'=7 -'SELECT'=8 -'FROM'=9 -'FILTER'=10 -'*'=11 -'SAME'=12 -'DISTINCT'=13 -'('=14 -')'=15 -'@'=16 -'0'=19 +NOT_OP=1 +AND_OP=2 +OR_OP=3 +SIMPLE_OP=4 +REP=5 +IN=6 +AS=7 +CBF=8 +SELECT=9 +FROM=10 +FILTER=11 +WILDCARD=12 +CLAUSE_SAME=13 +CLAUSE_DISTINCT=14 +L_PAREN=15 +R_PAREN=16 +AT=17 +IDENT=18 +NUMBER1=19 +ZERO=20 +STRING=21 +WS=22 +'NOT'=1 +'AND'=2 +'OR'=3 +'REP'=5 +'IN'=6 +'AS'=7 +'CBF'=8 +'SELECT'=9 +'FROM'=10 +'FILTER'=11 +'*'=12 +'SAME'=13 +'DISTINCT'=14 +'('=15 +')'=16 +'@'=17 +'0'=20 diff --git a/netmap/parser/query_base_visitor.go b/netmap/parser/query_base_visitor.go index 123302c..fa1cce8 100644 --- a/netmap/parser/query_base_visitor.go +++ b/netmap/parser/query_base_visitor.go @@ -1,5 +1,3 @@ -// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT. - package parser // Query import "github.com/antlr4-go/antlr/v4" diff --git a/netmap/parser/query_lexer.go b/netmap/parser/query_lexer.go index 17b2b35..b9224b6 100644 --- a/netmap/parser/query_lexer.go +++ b/netmap/parser/query_lexer.go @@ -1,12 +1,11 @@ -// Code generated from /work/netmap/parser/QueryLexer.g4 by ANTLR 4.13.0. DO NOT EDIT. - package parser import ( "fmt" - "github.com/antlr4-go/antlr/v4" "sync" "unicode" + + "github.com/antlr4-go/antlr/v4" ) // Suppress unused import error @@ -43,112 +42,114 @@ func querylexerLexerInit() { "DEFAULT_MODE", } staticData.LiteralNames = []string{ - "", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'", - "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'", - "", "", "'0'", + "", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", + "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", + "')'", "'@'", "", "", "'0'", } staticData.SymbolicNames = []string{ - "", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", - "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", - "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", + "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", + "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", + "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", } staticData.RuleNames = []string{ - "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", - "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", - "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING", - "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", + "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", + "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", + "L_PAREN", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", + "ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", "WS", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, + 4, 0, 22, 204, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, - 2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, - 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, - 2, 77, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, - 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, - 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, - 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, - 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, - 1, 16, 1, 16, 1, 16, 5, 16, 137, 8, 16, 10, 16, 12, 16, 140, 9, 16, 1, - 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 148, 8, 19, 10, 19, 12, 19, - 151, 9, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 158, 8, 21, 10, 21, - 12, 21, 161, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 167, 8, 21, 10, - 21, 12, 21, 170, 9, 21, 1, 21, 3, 21, 173, 8, 21, 1, 22, 1, 22, 1, 22, - 3, 22, 178, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, - 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 4, 27, 193, 8, 27, 11, 27, 12, 27, - 194, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, - 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, - 17, 35, 0, 37, 0, 39, 18, 41, 19, 43, 20, 45, 0, 47, 0, 49, 0, 51, 0, 53, - 0, 55, 21, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, - 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, - 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, - 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 205, - 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, - 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, - 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, - 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, - 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, - 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 61, 1, 0, 0, 0, 5, - 76, 1, 0, 0, 0, 7, 78, 1, 0, 0, 0, 9, 82, 1, 0, 0, 0, 11, 85, 1, 0, 0, - 0, 13, 88, 1, 0, 0, 0, 15, 92, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 104, - 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 118, 1, 0, 0, - 0, 27, 127, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 133, - 1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 145, 1, 0, 0, - 0, 41, 152, 1, 0, 0, 0, 43, 172, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 179, - 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 187, 1, 0, 0, 0, 53, 189, 1, 0, 0, - 0, 55, 192, 1, 0, 0, 0, 57, 58, 5, 65, 0, 0, 58, 59, 5, 78, 0, 0, 59, 60, - 5, 68, 0, 0, 60, 2, 1, 0, 0, 0, 61, 62, 5, 79, 0, 0, 62, 63, 5, 82, 0, - 0, 63, 4, 1, 0, 0, 0, 64, 65, 5, 69, 0, 0, 65, 77, 5, 81, 0, 0, 66, 67, - 5, 78, 0, 0, 67, 77, 5, 69, 0, 0, 68, 69, 5, 71, 0, 0, 69, 77, 5, 69, 0, - 0, 70, 71, 5, 71, 0, 0, 71, 77, 5, 84, 0, 0, 72, 73, 5, 76, 0, 0, 73, 77, - 5, 84, 0, 0, 74, 75, 5, 76, 0, 0, 75, 77, 5, 69, 0, 0, 76, 64, 1, 0, 0, - 0, 76, 66, 1, 0, 0, 0, 76, 68, 1, 0, 0, 0, 76, 70, 1, 0, 0, 0, 76, 72, - 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 6, 1, 0, 0, 0, 78, 79, 5, 82, 0, 0, - 79, 80, 5, 69, 0, 0, 80, 81, 5, 80, 0, 0, 81, 8, 1, 0, 0, 0, 82, 83, 5, - 73, 0, 0, 83, 84, 5, 78, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 65, 0, 0, - 86, 87, 5, 83, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 67, 0, 0, 89, 90, 5, - 66, 0, 0, 90, 91, 5, 70, 0, 0, 91, 14, 1, 0, 0, 0, 92, 93, 5, 83, 0, 0, - 93, 94, 5, 69, 0, 0, 94, 95, 5, 76, 0, 0, 95, 96, 5, 69, 0, 0, 96, 97, - 5, 67, 0, 0, 97, 98, 5, 84, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 70, 0, - 0, 100, 101, 5, 82, 0, 0, 101, 102, 5, 79, 0, 0, 102, 103, 5, 77, 0, 0, - 103, 18, 1, 0, 0, 0, 104, 105, 5, 70, 0, 0, 105, 106, 5, 73, 0, 0, 106, - 107, 5, 76, 0, 0, 107, 108, 5, 84, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, - 5, 82, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 42, 0, 0, 112, 22, 1, 0, - 0, 0, 113, 114, 5, 83, 0, 0, 114, 115, 5, 65, 0, 0, 115, 116, 5, 77, 0, - 0, 116, 117, 5, 69, 0, 0, 117, 24, 1, 0, 0, 0, 118, 119, 5, 68, 0, 0, 119, - 120, 5, 73, 0, 0, 120, 121, 5, 83, 0, 0, 121, 122, 5, 84, 0, 0, 122, 123, - 5, 73, 0, 0, 123, 124, 5, 78, 0, 0, 124, 125, 5, 67, 0, 0, 125, 126, 5, - 84, 0, 0, 126, 26, 1, 0, 0, 0, 127, 128, 5, 40, 0, 0, 128, 28, 1, 0, 0, - 0, 129, 130, 5, 41, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 64, 0, 0, 132, - 32, 1, 0, 0, 0, 133, 138, 3, 37, 18, 0, 134, 137, 3, 35, 17, 0, 135, 137, - 3, 37, 18, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 140, 1, - 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 34, 1, 0, 0, - 0, 140, 138, 1, 0, 0, 0, 141, 142, 7, 0, 0, 0, 142, 36, 1, 0, 0, 0, 143, - 144, 7, 1, 0, 0, 144, 38, 1, 0, 0, 0, 145, 149, 7, 2, 0, 0, 146, 148, 3, - 35, 17, 0, 147, 146, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, 1, 0, - 0, 0, 149, 150, 1, 0, 0, 0, 150, 40, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, - 152, 153, 5, 48, 0, 0, 153, 42, 1, 0, 0, 0, 154, 159, 5, 34, 0, 0, 155, - 158, 3, 45, 22, 0, 156, 158, 3, 53, 26, 0, 157, 155, 1, 0, 0, 0, 157, 156, - 1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, - 0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 173, 5, 34, 0, 0, - 163, 168, 5, 39, 0, 0, 164, 167, 3, 45, 22, 0, 165, 167, 3, 51, 25, 0, - 166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, - 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168, - 1, 0, 0, 0, 171, 173, 5, 39, 0, 0, 172, 154, 1, 0, 0, 0, 172, 163, 1, 0, - 0, 0, 173, 44, 1, 0, 0, 0, 174, 177, 5, 92, 0, 0, 175, 178, 7, 3, 0, 0, - 176, 178, 3, 47, 23, 0, 177, 175, 1, 0, 0, 0, 177, 176, 1, 0, 0, 0, 178, - 46, 1, 0, 0, 0, 179, 180, 5, 117, 0, 0, 180, 181, 3, 49, 24, 0, 181, 182, - 3, 49, 24, 0, 182, 183, 3, 49, 24, 0, 183, 184, 3, 49, 24, 0, 184, 48, - 1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 50, 1, 0, 0, 0, 187, 188, 8, 5, - 0, 0, 188, 52, 1, 0, 0, 0, 189, 190, 8, 6, 0, 0, 190, 54, 1, 0, 0, 0, 191, - 193, 7, 7, 0, 0, 192, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, - 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 27, - 0, 0, 197, 56, 1, 0, 0, 0, 12, 0, 76, 136, 138, 149, 157, 159, 166, 168, - 172, 177, 194, 1, 6, 0, 0, + 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 83, 8, 3, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, + 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, + 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, + 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, + 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 5, 17, + 143, 8, 17, 10, 17, 12, 17, 146, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, + 20, 1, 20, 5, 20, 154, 8, 20, 10, 20, 12, 20, 157, 9, 20, 1, 21, 1, 21, + 1, 22, 1, 22, 1, 22, 5, 22, 164, 8, 22, 10, 22, 12, 22, 167, 9, 22, 1, + 22, 1, 22, 1, 22, 1, 22, 5, 22, 173, 8, 22, 10, 22, 12, 22, 176, 9, 22, + 1, 22, 3, 22, 179, 8, 22, 1, 23, 1, 23, 1, 23, 3, 23, 184, 8, 23, 1, 24, + 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, + 27, 1, 28, 4, 28, 199, 8, 28, 11, 28, 12, 28, 200, 1, 28, 1, 28, 0, 0, + 29, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, + 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 0, 39, + 0, 41, 19, 43, 20, 45, 21, 47, 0, 49, 0, 51, 0, 53, 0, 55, 0, 57, 22, 1, + 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, + 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, + 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, + 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 211, 0, 1, 1, 0, 0, + 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, + 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, + 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, + 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, + 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, + 45, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 1, 59, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0, + 5, 67, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 84, 1, 0, 0, 0, 11, 88, 1, 0, + 0, 0, 13, 91, 1, 0, 0, 0, 15, 94, 1, 0, 0, 0, 17, 98, 1, 0, 0, 0, 19, 105, + 1, 0, 0, 0, 21, 110, 1, 0, 0, 0, 23, 117, 1, 0, 0, 0, 25, 119, 1, 0, 0, + 0, 27, 124, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 135, 1, 0, 0, 0, 33, 137, + 1, 0, 0, 0, 35, 139, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 149, 1, 0, 0, + 0, 41, 151, 1, 0, 0, 0, 43, 158, 1, 0, 0, 0, 45, 178, 1, 0, 0, 0, 47, 180, + 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 193, 1, 0, 0, + 0, 55, 195, 1, 0, 0, 0, 57, 198, 1, 0, 0, 0, 59, 60, 5, 78, 0, 0, 60, 61, + 5, 79, 0, 0, 61, 62, 5, 84, 0, 0, 62, 2, 1, 0, 0, 0, 63, 64, 5, 65, 0, + 0, 64, 65, 5, 78, 0, 0, 65, 66, 5, 68, 0, 0, 66, 4, 1, 0, 0, 0, 67, 68, + 5, 79, 0, 0, 68, 69, 5, 82, 0, 0, 69, 6, 1, 0, 0, 0, 70, 71, 5, 69, 0, + 0, 71, 83, 5, 81, 0, 0, 72, 73, 5, 78, 0, 0, 73, 83, 5, 69, 0, 0, 74, 75, + 5, 71, 0, 0, 75, 83, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 83, 5, 84, 0, + 0, 78, 79, 5, 76, 0, 0, 79, 83, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 83, + 5, 69, 0, 0, 82, 70, 1, 0, 0, 0, 82, 72, 1, 0, 0, 0, 82, 74, 1, 0, 0, 0, + 82, 76, 1, 0, 0, 0, 82, 78, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 8, 1, 0, + 0, 0, 84, 85, 5, 82, 0, 0, 85, 86, 5, 69, 0, 0, 86, 87, 5, 80, 0, 0, 87, + 10, 1, 0, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 78, 0, 0, 90, 12, 1, 0, + 0, 0, 91, 92, 5, 65, 0, 0, 92, 93, 5, 83, 0, 0, 93, 14, 1, 0, 0, 0, 94, + 95, 5, 67, 0, 0, 95, 96, 5, 66, 0, 0, 96, 97, 5, 70, 0, 0, 97, 16, 1, 0, + 0, 0, 98, 99, 5, 83, 0, 0, 99, 100, 5, 69, 0, 0, 100, 101, 5, 76, 0, 0, + 101, 102, 5, 69, 0, 0, 102, 103, 5, 67, 0, 0, 103, 104, 5, 84, 0, 0, 104, + 18, 1, 0, 0, 0, 105, 106, 5, 70, 0, 0, 106, 107, 5, 82, 0, 0, 107, 108, + 5, 79, 0, 0, 108, 109, 5, 77, 0, 0, 109, 20, 1, 0, 0, 0, 110, 111, 5, 70, + 0, 0, 111, 112, 5, 73, 0, 0, 112, 113, 5, 76, 0, 0, 113, 114, 5, 84, 0, + 0, 114, 115, 5, 69, 0, 0, 115, 116, 5, 82, 0, 0, 116, 22, 1, 0, 0, 0, 117, + 118, 5, 42, 0, 0, 118, 24, 1, 0, 0, 0, 119, 120, 5, 83, 0, 0, 120, 121, + 5, 65, 0, 0, 121, 122, 5, 77, 0, 0, 122, 123, 5, 69, 0, 0, 123, 26, 1, + 0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 73, 0, 0, 126, 127, 5, 83, + 0, 0, 127, 128, 5, 84, 0, 0, 128, 129, 5, 73, 0, 0, 129, 130, 5, 78, 0, + 0, 130, 131, 5, 67, 0, 0, 131, 132, 5, 84, 0, 0, 132, 28, 1, 0, 0, 0, 133, + 134, 5, 40, 0, 0, 134, 30, 1, 0, 0, 0, 135, 136, 5, 41, 0, 0, 136, 32, + 1, 0, 0, 0, 137, 138, 5, 64, 0, 0, 138, 34, 1, 0, 0, 0, 139, 144, 3, 39, + 19, 0, 140, 143, 3, 37, 18, 0, 141, 143, 3, 39, 19, 0, 142, 140, 1, 0, + 0, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, + 144, 145, 1, 0, 0, 0, 145, 36, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148, + 7, 0, 0, 0, 148, 38, 1, 0, 0, 0, 149, 150, 7, 1, 0, 0, 150, 40, 1, 0, 0, + 0, 151, 155, 7, 2, 0, 0, 152, 154, 3, 37, 18, 0, 153, 152, 1, 0, 0, 0, + 154, 157, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, + 42, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 158, 159, 5, 48, 0, 0, 159, 44, 1, + 0, 0, 0, 160, 165, 5, 34, 0, 0, 161, 164, 3, 47, 23, 0, 162, 164, 3, 55, + 27, 0, 163, 161, 1, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, + 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 168, 1, 0, 0, 0, 167, + 165, 1, 0, 0, 0, 168, 179, 5, 34, 0, 0, 169, 174, 5, 39, 0, 0, 170, 173, + 3, 47, 23, 0, 171, 173, 3, 53, 26, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1, + 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, + 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 179, 5, 39, 0, 0, 178, + 160, 1, 0, 0, 0, 178, 169, 1, 0, 0, 0, 179, 46, 1, 0, 0, 0, 180, 183, 5, + 92, 0, 0, 181, 184, 7, 3, 0, 0, 182, 184, 3, 49, 24, 0, 183, 181, 1, 0, + 0, 0, 183, 182, 1, 0, 0, 0, 184, 48, 1, 0, 0, 0, 185, 186, 5, 117, 0, 0, + 186, 187, 3, 51, 25, 0, 187, 188, 3, 51, 25, 0, 188, 189, 3, 51, 25, 0, + 189, 190, 3, 51, 25, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 4, 0, 0, 192, + 52, 1, 0, 0, 0, 193, 194, 8, 5, 0, 0, 194, 54, 1, 0, 0, 0, 195, 196, 8, + 6, 0, 0, 196, 56, 1, 0, 0, 0, 197, 199, 7, 7, 0, 0, 198, 197, 1, 0, 0, + 0, 199, 200, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, + 202, 1, 0, 0, 0, 202, 203, 6, 28, 0, 0, 203, 58, 1, 0, 0, 0, 12, 0, 82, + 142, 144, 155, 163, 165, 172, 174, 178, 183, 200, 1, 6, 0, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -189,25 +190,26 @@ func NewQueryLexer(input antlr.CharStream) *QueryLexer { // QueryLexer tokens. const ( - QueryLexerAND_OP = 1 - QueryLexerOR_OP = 2 - QueryLexerSIMPLE_OP = 3 - QueryLexerREP = 4 - QueryLexerIN = 5 - QueryLexerAS = 6 - QueryLexerCBF = 7 - QueryLexerSELECT = 8 - QueryLexerFROM = 9 - QueryLexerFILTER = 10 - QueryLexerWILDCARD = 11 - QueryLexerCLAUSE_SAME = 12 - QueryLexerCLAUSE_DISTINCT = 13 - QueryLexerL_PAREN = 14 - QueryLexerR_PAREN = 15 - QueryLexerAT = 16 - QueryLexerIDENT = 17 - QueryLexerNUMBER1 = 18 - QueryLexerZERO = 19 - QueryLexerSTRING = 20 - QueryLexerWS = 21 + QueryLexerNOT_OP = 1 + QueryLexerAND_OP = 2 + QueryLexerOR_OP = 3 + QueryLexerSIMPLE_OP = 4 + QueryLexerREP = 5 + QueryLexerIN = 6 + QueryLexerAS = 7 + QueryLexerCBF = 8 + QueryLexerSELECT = 9 + QueryLexerFROM = 10 + QueryLexerFILTER = 11 + QueryLexerWILDCARD = 12 + QueryLexerCLAUSE_SAME = 13 + QueryLexerCLAUSE_DISTINCT = 14 + QueryLexerL_PAREN = 15 + QueryLexerR_PAREN = 16 + QueryLexerAT = 17 + QueryLexerIDENT = 18 + QueryLexerNUMBER1 = 19 + QueryLexerZERO = 20 + QueryLexerSTRING = 21 + QueryLexerWS = 22 ) diff --git a/netmap/parser/query_parser.go b/netmap/parser/query_parser.go index 1909b55..3dda93e 100644 --- a/netmap/parser/query_parser.go +++ b/netmap/parser/query_parser.go @@ -1,5 +1,3 @@ -// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT. - package parser // Query import ( @@ -33,14 +31,14 @@ var QueryParserStaticData struct { func queryParserInit() { staticData := &QueryParserStaticData staticData.LiteralNames = []string{ - "", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'", - "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'", - "", "", "'0'", + "", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", + "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", + "')'", "'@'", "", "", "'0'", } staticData.SymbolicNames = []string{ - "", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", - "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", - "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", + "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", + "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", + "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", } staticData.RuleNames = []string{ "policy", "repStmt", "cbfStmt", "selectStmt", "clause", "filterExpr", @@ -49,60 +47,62 @@ func queryParserInit() { } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 22, 135, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, - 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 83, - 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 91, 8, 5, 10, 5, 12, 5, - 94, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, - 7, 3, 7, 107, 8, 7, 1, 8, 1, 8, 3, 8, 111, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, - 116, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 124, 8, 12, - 1, 13, 1, 13, 3, 13, 128, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, - 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 12, 13, 1, 0, 18, 19, 2, 0, - 4, 6, 8, 10, 132, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0, - 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 95, 1, - 0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 115, 1, 0, 0, 0, - 20, 117, 1, 0, 0, 0, 22, 119, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 127, - 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, - 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, - 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36, - 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, - 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44, - 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, - 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5, - 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 4, 0, 0, 51, 54, 5, 18, 0, 0, 52, - 53, 5, 5, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, - 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 7, 0, 0, 57, 58, 5, 18, 0, 0, 58, 5, - 1, 0, 0, 0, 59, 60, 5, 8, 0, 0, 60, 66, 5, 18, 0, 0, 61, 63, 5, 5, 0, 0, - 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, - 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, - 67, 68, 1, 0, 0, 0, 68, 69, 5, 9, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5, - 6, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, - 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5, - -1, 0, 77, 78, 5, 14, 0, 0, 78, 79, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80, - 83, 1, 0, 0, 0, 81, 83, 3, 14, 7, 0, 82, 76, 1, 0, 0, 0, 82, 81, 1, 0, - 0, 0, 83, 92, 1, 0, 0, 0, 84, 85, 10, 4, 0, 0, 85, 86, 5, 1, 0, 0, 86, - 91, 3, 10, 5, 5, 87, 88, 10, 3, 0, 0, 88, 89, 5, 2, 0, 0, 89, 91, 3, 10, - 5, 4, 90, 84, 1, 0, 0, 0, 90, 87, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90, - 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, - 95, 96, 5, 10, 0, 0, 96, 97, 3, 10, 5, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3, - 24, 12, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 16, 0, 0, 101, 107, 3, 24, - 12, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 3, 0, 0, 104, 105, 3, 18, 9, - 0, 105, 107, 1, 0, 0, 0, 106, 100, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107, - 15, 1, 0, 0, 0, 108, 111, 3, 24, 12, 0, 109, 111, 5, 20, 0, 0, 110, 108, - 1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 17, 1, 0, 0, 0, 112, 116, 3, 24, - 12, 0, 113, 116, 3, 20, 10, 0, 114, 116, 5, 20, 0, 0, 115, 112, 1, 0, 0, - 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 19, 1, 0, 0, 0, 117, - 118, 7, 1, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 7, 2, 0, 0, 120, 23, 1, - 0, 0, 0, 121, 124, 3, 22, 11, 0, 122, 124, 5, 17, 0, 0, 123, 121, 1, 0, - 0, 0, 123, 122, 1, 0, 0, 0, 124, 25, 1, 0, 0, 0, 125, 128, 3, 24, 12, 0, - 126, 128, 5, 11, 0, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, 128, - 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 82, 90, 92, 106, 110, - 115, 123, 127, + 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, + 1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, + 5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, + 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 112, 8, 7, 1, 8, 1, 8, 3, 8, 116, 8, + 8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, + 1, 12, 3, 12, 129, 8, 12, 1, 13, 1, 13, 3, 13, 133, 8, 13, 1, 13, 0, 1, + 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, + 13, 14, 1, 0, 19, 20, 2, 0, 5, 7, 9, 11, 138, 0, 29, 1, 0, 0, 0, 2, 50, + 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, + 87, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 115, 1, 0, + 0, 0, 18, 120, 1, 0, 0, 0, 20, 122, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24, + 128, 1, 0, 0, 0, 26, 132, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, + 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, + 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, + 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, + 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, + 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, + 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, + 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 5, 0, 0, + 51, 54, 5, 19, 0, 0, 52, 53, 5, 6, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, + 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 8, 0, 0, + 57, 58, 5, 19, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 66, 5, + 19, 0, 0, 61, 63, 5, 6, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, + 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, + 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 10, 0, 0, 69, + 72, 3, 26, 13, 0, 70, 71, 5, 7, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, + 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, + 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 1, 0, 0, 78, 79, 5, 15, + 0, 0, 79, 80, 3, 10, 5, 0, 80, 81, 5, 16, 0, 0, 81, 88, 1, 0, 0, 0, 82, + 83, 5, 15, 0, 0, 83, 84, 3, 10, 5, 0, 84, 85, 5, 16, 0, 0, 85, 88, 1, 0, + 0, 0, 86, 88, 3, 14, 7, 0, 87, 76, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 87, + 86, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 5, 2, + 0, 0, 91, 96, 3, 10, 5, 5, 92, 93, 10, 3, 0, 0, 93, 94, 5, 3, 0, 0, 94, + 96, 3, 10, 5, 4, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0, + 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 11, 1, 0, 0, 0, 99, 97, + 1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 3, 10, 5, 0, 102, 103, 5, + 7, 0, 0, 103, 104, 3, 24, 12, 0, 104, 13, 1, 0, 0, 0, 105, 106, 5, 17, + 0, 0, 106, 112, 3, 24, 12, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 4, 0, + 0, 109, 110, 3, 18, 9, 0, 110, 112, 1, 0, 0, 0, 111, 105, 1, 0, 0, 0, 111, + 107, 1, 0, 0, 0, 112, 15, 1, 0, 0, 0, 113, 116, 3, 24, 12, 0, 114, 116, + 5, 21, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0, + 0, 0, 117, 121, 3, 24, 12, 0, 118, 121, 3, 20, 10, 0, 119, 121, 5, 21, + 0, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, + 121, 19, 1, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 21, 1, 0, 0, 0, 124, 125, + 7, 2, 0, 0, 125, 23, 1, 0, 0, 0, 126, 129, 3, 22, 11, 0, 127, 129, 5, 18, + 0, 0, 128, 126, 1, 0, 0, 0, 128, 127, 1, 0, 0, 0, 129, 25, 1, 0, 0, 0, + 130, 133, 3, 24, 12, 0, 131, 133, 5, 12, 0, 0, 132, 130, 1, 0, 0, 0, 132, + 131, 1, 0, 0, 0, 133, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, + 87, 95, 97, 111, 115, 120, 128, 132, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -141,27 +141,28 @@ func NewQuery(input antlr.TokenStream) *Query { // Query tokens. const ( QueryEOF = antlr.TokenEOF - QueryAND_OP = 1 - QueryOR_OP = 2 - QuerySIMPLE_OP = 3 - QueryREP = 4 - QueryIN = 5 - QueryAS = 6 - QueryCBF = 7 - QuerySELECT = 8 - QueryFROM = 9 - QueryFILTER = 10 - QueryWILDCARD = 11 - QueryCLAUSE_SAME = 12 - QueryCLAUSE_DISTINCT = 13 - QueryL_PAREN = 14 - QueryR_PAREN = 15 - QueryAT = 16 - QueryIDENT = 17 - QueryNUMBER1 = 18 - QueryZERO = 19 - QuerySTRING = 20 - QueryWS = 21 + QueryNOT_OP = 1 + QueryAND_OP = 2 + QueryOR_OP = 3 + QuerySIMPLE_OP = 4 + QueryREP = 5 + QueryIN = 6 + QueryAS = 7 + QueryCBF = 8 + QuerySELECT = 9 + QueryFROM = 10 + QueryFILTER = 11 + QueryWILDCARD = 12 + QueryCLAUSE_SAME = 13 + QueryCLAUSE_DISTINCT = 14 + QueryL_PAREN = 15 + QueryR_PAREN = 16 + QueryAT = 17 + QueryIDENT = 18 + QueryNUMBER1 = 19 + QueryZERO = 20 + QuerySTRING = 21 + QueryWS = 22 ) // Query rules. @@ -1265,6 +1266,7 @@ type IFilterExprContext interface { // Getter signatures L_PAREN() antlr.TerminalNode R_PAREN() antlr.TerminalNode + NOT_OP() antlr.TerminalNode AllFilterExpr() []IFilterExprContext FilterExpr(i int) IFilterExprContext Expr() IExprContext @@ -1279,8 +1281,8 @@ type FilterExprContext struct { antlr.BaseParserRuleContext parser antlr.Parser F1 IFilterExprContext - Inner IFilterExprContext Op antlr.Token + Inner IFilterExprContext F2 IFilterExprContext } @@ -1335,6 +1337,10 @@ func (s *FilterExprContext) R_PAREN() antlr.TerminalNode { return s.GetToken(QueryR_PAREN, 0) } +func (s *FilterExprContext) NOT_OP() antlr.TerminalNode { + return s.GetToken(QueryNOT_OP, 0) +} + func (s *FilterExprContext) AllFilterExpr() []IFilterExprContext { children := s.GetChildren() len := 0 @@ -1434,17 +1440,20 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(82) + p.SetState(87) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case QueryL_PAREN: + case QueryNOT_OP: { p.SetState(77) - p.Match(QueryL_PAREN) + + var _m = p.Match(QueryNOT_OP) + + localctx.(*FilterExprContext).Op = _m if p.HasError() { // Recognition error - abort rule goto errorExit @@ -1452,13 +1461,46 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } { p.SetState(78) + p.Match(QueryL_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(79) + + var _x = p.filterExpr(0) + + localctx.(*FilterExprContext).F1 = _x + } + { + p.SetState(80) + p.Match(QueryR_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case QueryL_PAREN: + { + p.SetState(82) + p.Match(QueryL_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(83) var _x = p.filterExpr(0) localctx.(*FilterExprContext).Inner = _x } { - p.SetState(79) + p.SetState(84) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1468,7 +1510,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING: { - p.SetState(81) + p.SetState(86) p.Expr() } @@ -1477,7 +1519,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(92) + p.SetState(97) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1492,7 +1534,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(90) + p.SetState(95) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1503,14 +1545,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(84) + p.SetState(89) if !(p.Precpred(p.GetParserRuleContext(), 4)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) goto errorExit } { - p.SetState(85) + p.SetState(90) var _m = p.Match(QueryAND_OP) @@ -1521,7 +1563,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(86) + p.SetState(91) var _x = p.filterExpr(5) @@ -1532,14 +1574,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(87) + p.SetState(92) if !(p.Precpred(p.GetParserRuleContext(), 3)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) goto errorExit } { - p.SetState(88) + p.SetState(93) var _m = p.Match(QueryOR_OP) @@ -1550,7 +1592,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(89) + p.SetState(94) var _x = p.filterExpr(4) @@ -1562,7 +1604,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } - p.SetState(94) + p.SetState(99) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1720,7 +1762,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { p.EnterRule(localctx, 12, QueryRULE_filterStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(95) + p.SetState(100) p.Match(QueryFILTER) if p.HasError() { // Recognition error - abort rule @@ -1728,14 +1770,14 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(96) + p.SetState(101) var _x = p.filterExpr(0) localctx.(*FilterStmtContext).Expr = _x } { - p.SetState(97) + p.SetState(102) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -1743,7 +1785,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(98) + p.SetState(103) var _x = p.Ident() @@ -1923,7 +1965,7 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Expr() (localctx IExprContext) { localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 14, QueryRULE_expr) - p.SetState(106) + p.SetState(111) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1933,7 +1975,7 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryAT: p.EnterOuterAlt(localctx, 1) { - p.SetState(100) + p.SetState(105) p.Match(QueryAT) if p.HasError() { // Recognition error - abort rule @@ -1941,7 +1983,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(101) + p.SetState(106) var _x = p.Ident() @@ -1951,14 +1993,14 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT, QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(102) + p.SetState(107) var _x = p.FilterKey() localctx.(*ExprContext).Key = _x } { - p.SetState(103) + p.SetState(108) p.Match(QuerySIMPLE_OP) if p.HasError() { // Recognition error - abort rule @@ -1966,7 +2008,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(104) + p.SetState(109) var _x = p.FilterValue() @@ -2079,7 +2121,7 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) FilterKey() (localctx IFilterKeyContext) { localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 16, QueryRULE_filterKey) - p.SetState(110) + p.SetState(115) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2089,14 +2131,14 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(108) + p.SetState(113) p.Ident() } case QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(109) + p.SetState(114) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2227,7 +2269,7 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *Query) FilterValue() (localctx IFilterValueContext) { localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 18, QueryRULE_filterValue) - p.SetState(115) + p.SetState(120) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2237,21 +2279,21 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(112) + p.SetState(117) p.Ident() } case QueryNUMBER1, QueryZERO: p.EnterOuterAlt(localctx, 2) { - p.SetState(113) + p.SetState(118) p.Number() } case QuerySTRING: p.EnterOuterAlt(localctx, 3) { - p.SetState(114) + p.SetState(119) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2357,7 +2399,7 @@ func (p *Query) Number() (localctx INumberContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(117) + p.SetState(122) _la = p.GetTokenStream().LA(1) if !(_la == QueryNUMBER1 || _la == QueryZERO) { @@ -2481,10 +2523,10 @@ func (p *Query) Keyword() (localctx IKeywordContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(119) + p.SetState(124) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1904) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3808) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -2593,7 +2635,7 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Ident() (localctx IIdentContext) { localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 24, QueryRULE_ident) - p.SetState(123) + p.SetState(128) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2603,14 +2645,14 @@ func (p *Query) Ident() (localctx IIdentContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER: p.EnterOuterAlt(localctx, 1) { - p.SetState(121) + p.SetState(126) p.Keyword() } case QueryIDENT: p.EnterOuterAlt(localctx, 2) { - p.SetState(122) + p.SetState(127) p.Match(QueryIDENT) if p.HasError() { // Recognition error - abort rule @@ -2724,7 +2766,7 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) IdentWC() (localctx IIdentWCContext) { localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 26, QueryRULE_identWC) - p.SetState(127) + p.SetState(132) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2734,14 +2776,14 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(125) + p.SetState(130) p.Ident() } case QueryWILDCARD: p.EnterOuterAlt(localctx, 2) { - p.SetState(126) + p.SetState(131) p.Match(QueryWILDCARD) if p.HasError() { // Recognition error - abort rule diff --git a/netmap/parser/query_visitor.go b/netmap/parser/query_visitor.go index edf8649..8123c39 100644 --- a/netmap/parser/query_visitor.go +++ b/netmap/parser/query_visitor.go @@ -1,5 +1,3 @@ -// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT. - package parser // Query import "github.com/antlr4-go/antlr/v4" diff --git a/netmap/policy.go b/netmap/policy.go index d5b265f..3f6986e 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -464,18 +464,33 @@ func writeFilterStringTo(w io.StringWriter, f netmap.Filter) error { } inner := f.GetFilters() - for i := range inner { - if i != 0 { - _, err = w.WriteString(" " + op.String() + " ") + + if op == netmap.NOT { + _, err = w.WriteString(op.String() + " (") + if err != nil { + return err + } + err = writeFilterStringTo(w, inner[0]) + if err != nil { + return err + } + _, err = w.WriteString(")") + if err != nil { + return err + } + } else { + for i := range inner { + if i != 0 { + _, err = w.WriteString(" " + op.String() + " ") + if err != nil { + return err + } + } + err = writeFilterStringTo(w, inner[i]) if err != nil { return err } } - - err = writeFilterStringTo(w, inner[i]) - if err != nil { - return err - } } if s = f.GetName(); s != "" && !unspecified { @@ -671,6 +686,12 @@ func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) any { op := operationFromString(ctx.GetOp().GetText()) f.SetOp(op) + if op == netmap.NOT { + f1 := *ctx.GetF1().Accept(p).(*netmap.Filter) + f.SetFilters([]netmap.Filter{f1}) + return f + } + f1 := *ctx.GetF1().Accept(p).(*netmap.Filter) f2 := *ctx.GetF2().Accept(p).(*netmap.Filter) diff --git a/netmap/policy_test.go b/netmap/policy_test.go index b184cb2..f0a7bc5 100644 --- a/netmap/policy_test.go +++ b/netmap/policy_test.go @@ -23,6 +23,10 @@ FILTER @FromRU AND Rating GT 7 AS Good`, `REP 7 IN SPB SELECT 1 IN City FROM SPBSSD AS SPB FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`, + + `REP 7 IN SPB +SELECT 1 IN City FROM SPBSSD AS SPB +FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS SPBSSD`, } var p PlacementPolicy diff --git a/netmap/selector_test.go b/netmap/selector_test.go index aa415be..a974852 100644 --- a/netmap/selector_test.go +++ b/netmap/selector_test.go @@ -244,6 +244,57 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { } } +func TestPlacementPolicy_ProcessSelectorsExceptForNodes(t *testing.T) { + p := newPlacementPolicy(1, nil, + []Selector{ + newSelector("ExceptRU", "City", 2, "ExceptRU", (*Selector).SelectSame), + }, + []Filter{ + newFilter("ExceptRU", "", "", netmap.NOT, + newFilter("", "", "", netmap.AND, + newFilter("", "City", "Lyon", netmap.EQ), + newFilter("", "Rating", "10", netmap.LE), + ), + ), + }) + nodes := []NodeInfo{ + nodeInfoFromAttributes("Country", "Germany", "Rating", "1", "City", "Berlin"), + nodeInfoFromAttributes("Country", "Germany", "Rating", "5", "City", "Berlin"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "6", "City", "Moscow"), + nodeInfoFromAttributes("Country", "France", "Rating", "4", "City", "Paris"), + nodeInfoFromAttributes("Country", "France", "Rating", "1", "City", "Lyon"), + nodeInfoFromAttributes("Country", "France", "Rating", "5", "City", "Lyon"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "7", "City", "Moscow"), + nodeInfoFromAttributes("Country", "Germany", "Rating", "3", "City", "Darmstadt"), + nodeInfoFromAttributes("Country", "Germany", "Rating", "7", "City", "Frankfurt"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), + } + + var nm NetMap + nm.SetNodes(nodes) + c := newContext(nm) + c.setCBF(p.backupFactor) + require.NoError(t, c.processFilters(p)) + require.NoError(t, c.processSelectors(p)) + + for _, s := range p.selectors { + sel := c.selections[s.GetName()] + s := c.processedSelectors[s.GetName()] + bucketCount, nodesInBucket := calcNodesCount(*s) + nodesInBucket *= int(c.cbf) + targ := fmt.Sprintf("selector '%s'", s.GetName()) + require.Equal(t, bucketCount, len(sel), targ) + fName := s.GetFilter() + for _, res := range sel { + require.Equal(t, nodesInBucket, len(res), targ) + for j := range res { + require.True(t, fName == mainFilterName || c.match(c.processedFilters[fName], res[j]), targ) + } + } + } +} + func TestSelector_SetName(t *testing.T) { const name = "some name" var s Selector From fcbf96add6929834715ed4d3efd43adcd80632d4 Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Mon, 5 Jun 2023 13:38:15 +0300 Subject: [PATCH 021/323] [#76] Add UNIQUE keyword Signed-off-by: Alejandro Lopez --- netmap/context.go | 12 + netmap/netmap.go | 35 ++- netmap/parser/Query.g4 | 2 +- netmap/parser/Query.interp | 4 +- netmap/parser/Query.tokens | 66 +++--- netmap/parser/QueryLexer.g4 | 1 + netmap/parser/QueryLexer.interp | 5 +- netmap/parser/QueryLexer.tokens | 66 +++--- netmap/parser/generate.go | 4 +- netmap/parser/query_base_visitor.go | 2 + netmap/parser/query_lexer.go | 235 ++++++++++--------- netmap/parser/query_parser.go | 343 +++++++++++++++------------- netmap/parser/query_visitor.go | 2 + netmap/policy.go | 21 ++ netmap/policy_test.go | 4 + netmap/selector.go | 3 + netmap/selector_test.go | 38 +++ 17 files changed, 498 insertions(+), 345 deletions(-) diff --git a/netmap/context.go b/netmap/context.go index e1c426a..00942e5 100644 --- a/netmap/context.go +++ b/netmap/context.go @@ -35,6 +35,11 @@ type context struct { // container backup factor cbf uint32 + + // nodes already used in previous selections, which is needed when the placement + // policy uses the UNIQUE flag. Nodes marked as used are not used in subsequent + // base selections. + usedNodes map[uint64]bool } // Various validation errors. @@ -58,6 +63,7 @@ func newContext(nm NetMap) *context { numCache: make(map[string]uint64), weightFunc: defaultWeightFunc(nm.nodes), + usedNodes: make(map[uint64]bool), } } @@ -76,6 +82,12 @@ func (c *context) setCBF(cbf uint32) { } } +func (c *context) addUsedNodes(ns ...NodeInfo) { + for _, n := range ns { + c.usedNodes[n.hash] = true + } +} + func defaultWeightFunc(ns nodes) weightFunc { mean := newMeanAgg() min := newMinAgg() diff --git a/netmap/netmap.go b/netmap/netmap.go index c839df8..c9969b6 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -181,6 +181,10 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e result := make([][]NodeInfo, len(p.replicas)) + // Note that the cached selectors are not used when the policy contains the UNIQUE flag. + // This is necessary because each selection vector affects potentially the subsequent vectors + // and thus we call getSelection in such case, in order to take into account nodes previously + // marked as used by earlier replicas. for i := range p.replicas { sName := p.replicas[i].GetSelector() if sName == "" { @@ -198,18 +202,39 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e } for i := range p.selectors { - result[i] = append(result[i], flattenNodes(c.selections[p.selectors[i].GetName()])...) + if p.unique { + nodes, err := c.getSelection(p.selectors[i]) + if err != nil { + return nil, err + } + result[i] = append(result[i], flattenNodes(nodes)...) + } else { + result[i] = append(result[i], flattenNodes(c.selections[p.selectors[i].GetName()])...) + } + } + + if p.unique { + c.addUsedNodes(result[i]...) } continue } - nodes, ok := c.selections[sName] - if !ok { - return nil, fmt.Errorf("selector not found: REPLICA '%s'", sName) + if p.unique { + nodes, err := c.getSelection(*c.processedSelectors[sName]) + if err != nil { + return nil, err + } + result[i] = append(result[i], flattenNodes(nodes)...) + c.addUsedNodes(result[i]...) + } else { + nodes, ok := c.selections[sName] + if !ok { + return nil, fmt.Errorf("selector not found: REPLICA '%s'", sName) + } + result[i] = append(result[i], flattenNodes(nodes)...) } - result[i] = append(result[i], flattenNodes(nodes)...) } return result, nil diff --git a/netmap/parser/Query.g4 b/netmap/parser/Query.g4 index a52746a..abae181 100644 --- a/netmap/parser/Query.g4 +++ b/netmap/parser/Query.g4 @@ -4,7 +4,7 @@ options { tokenVocab = QueryLexer; } -policy: repStmt+ cbfStmt? selectStmt* filterStmt* EOF; +policy: UNIQUE? repStmt+ cbfStmt? selectStmt* filterStmt* EOF; repStmt: REP Count = NUMBER1 // number of object replicas diff --git a/netmap/parser/Query.interp b/netmap/parser/Query.interp index 60db0a9..df98c28 100644 --- a/netmap/parser/Query.interp +++ b/netmap/parser/Query.interp @@ -4,6 +4,7 @@ null 'AND' 'OR' null +'UNIQUE' 'REP' 'IN' 'AS' @@ -29,6 +30,7 @@ NOT_OP AND_OP OR_OP SIMPLE_OP +UNIQUE REP IN AS @@ -66,4 +68,4 @@ identWC atn: -[4, 1, 22, 135, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 112, 8, 7, 1, 8, 1, 8, 3, 8, 116, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 129, 8, 12, 1, 13, 1, 13, 3, 13, 133, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 13, 14, 1, 0, 19, 20, 2, 0, 5, 7, 9, 11, 138, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 87, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 115, 1, 0, 0, 0, 18, 120, 1, 0, 0, 0, 20, 122, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24, 128, 1, 0, 0, 0, 26, 132, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 5, 0, 0, 51, 54, 5, 19, 0, 0, 52, 53, 5, 6, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 8, 0, 0, 57, 58, 5, 19, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 66, 5, 19, 0, 0, 61, 63, 5, 6, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 10, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5, 7, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 1, 0, 0, 78, 79, 5, 15, 0, 0, 79, 80, 3, 10, 5, 0, 80, 81, 5, 16, 0, 0, 81, 88, 1, 0, 0, 0, 82, 83, 5, 15, 0, 0, 83, 84, 3, 10, 5, 0, 84, 85, 5, 16, 0, 0, 85, 88, 1, 0, 0, 0, 86, 88, 3, 14, 7, 0, 87, 76, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 87, 86, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 5, 2, 0, 0, 91, 96, 3, 10, 5, 5, 92, 93, 10, 3, 0, 0, 93, 94, 5, 3, 0, 0, 94, 96, 3, 10, 5, 4, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 11, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 3, 10, 5, 0, 102, 103, 5, 7, 0, 0, 103, 104, 3, 24, 12, 0, 104, 13, 1, 0, 0, 0, 105, 106, 5, 17, 0, 0, 106, 112, 3, 24, 12, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 4, 0, 0, 109, 110, 3, 18, 9, 0, 110, 112, 1, 0, 0, 0, 111, 105, 1, 0, 0, 0, 111, 107, 1, 0, 0, 0, 112, 15, 1, 0, 0, 0, 113, 116, 3, 24, 12, 0, 114, 116, 5, 21, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0, 0, 0, 117, 121, 3, 24, 12, 0, 118, 121, 3, 20, 10, 0, 119, 121, 5, 21, 0, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, 121, 19, 1, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 21, 1, 0, 0, 0, 124, 125, 7, 2, 0, 0, 125, 23, 1, 0, 0, 0, 126, 129, 3, 22, 11, 0, 127, 129, 5, 18, 0, 0, 128, 126, 1, 0, 0, 0, 128, 127, 1, 0, 0, 0, 129, 25, 1, 0, 0, 0, 130, 133, 3, 24, 12, 0, 131, 133, 5, 12, 0, 0, 132, 130, 1, 0, 0, 0, 132, 131, 1, 0, 0, 0, 133, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 87, 95, 97, 111, 115, 120, 128, 132] \ No newline at end of file +[4, 1, 23, 138, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 3, 0, 30, 8, 0, 1, 0, 4, 0, 33, 8, 0, 11, 0, 12, 0, 34, 1, 0, 3, 0, 38, 8, 0, 1, 0, 5, 0, 41, 8, 0, 10, 0, 12, 0, 44, 9, 0, 1, 0, 5, 0, 47, 8, 0, 10, 0, 12, 0, 50, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 58, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 3, 3, 70, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 76, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 91, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 99, 8, 5, 10, 5, 12, 5, 102, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 115, 8, 7, 1, 8, 1, 8, 3, 8, 119, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 124, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 132, 8, 12, 1, 13, 1, 13, 3, 13, 136, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 142, 0, 29, 1, 0, 0, 0, 2, 53, 1, 0, 0, 0, 4, 59, 1, 0, 0, 0, 6, 62, 1, 0, 0, 0, 8, 77, 1, 0, 0, 0, 10, 90, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 114, 1, 0, 0, 0, 16, 118, 1, 0, 0, 0, 18, 123, 1, 0, 0, 0, 20, 125, 1, 0, 0, 0, 22, 127, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 135, 1, 0, 0, 0, 28, 30, 5, 5, 0, 0, 29, 28, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 32, 1, 0, 0, 0, 31, 33, 3, 2, 1, 0, 32, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 3, 4, 2, 0, 37, 36, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 42, 1, 0, 0, 0, 39, 41, 3, 6, 3, 0, 40, 39, 1, 0, 0, 0, 41, 44, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 48, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 45, 47, 3, 12, 6, 0, 46, 45, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 52, 5, 0, 0, 1, 52, 1, 1, 0, 0, 0, 53, 54, 5, 6, 0, 0, 54, 57, 5, 20, 0, 0, 55, 56, 5, 7, 0, 0, 56, 58, 3, 24, 12, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 3, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 61, 5, 20, 0, 0, 61, 5, 1, 0, 0, 0, 62, 63, 5, 10, 0, 0, 63, 69, 5, 20, 0, 0, 64, 66, 5, 7, 0, 0, 65, 67, 3, 8, 4, 0, 66, 65, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 3, 24, 12, 0, 69, 64, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 72, 5, 11, 0, 0, 72, 75, 3, 26, 13, 0, 73, 74, 5, 8, 0, 0, 74, 76, 3, 24, 12, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 7, 1, 0, 0, 0, 77, 78, 7, 0, 0, 0, 78, 9, 1, 0, 0, 0, 79, 80, 6, 5, -1, 0, 80, 81, 5, 1, 0, 0, 81, 82, 5, 16, 0, 0, 82, 83, 3, 10, 5, 0, 83, 84, 5, 17, 0, 0, 84, 91, 1, 0, 0, 0, 85, 86, 5, 16, 0, 0, 86, 87, 3, 10, 5, 0, 87, 88, 5, 17, 0, 0, 88, 91, 1, 0, 0, 0, 89, 91, 3, 14, 7, 0, 90, 79, 1, 0, 0, 0, 90, 85, 1, 0, 0, 0, 90, 89, 1, 0, 0, 0, 91, 100, 1, 0, 0, 0, 92, 93, 10, 4, 0, 0, 93, 94, 5, 2, 0, 0, 94, 99, 3, 10, 5, 5, 95, 96, 10, 3, 0, 0, 96, 97, 5, 3, 0, 0, 97, 99, 3, 10, 5, 4, 98, 92, 1, 0, 0, 0, 98, 95, 1, 0, 0, 0, 99, 102, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 11, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 103, 104, 5, 12, 0, 0, 104, 105, 3, 10, 5, 0, 105, 106, 5, 8, 0, 0, 106, 107, 3, 24, 12, 0, 107, 13, 1, 0, 0, 0, 108, 109, 5, 18, 0, 0, 109, 115, 3, 24, 12, 0, 110, 111, 3, 16, 8, 0, 111, 112, 5, 4, 0, 0, 112, 113, 3, 18, 9, 0, 113, 115, 1, 0, 0, 0, 114, 108, 1, 0, 0, 0, 114, 110, 1, 0, 0, 0, 115, 15, 1, 0, 0, 0, 116, 119, 3, 24, 12, 0, 117, 119, 5, 22, 0, 0, 118, 116, 1, 0, 0, 0, 118, 117, 1, 0, 0, 0, 119, 17, 1, 0, 0, 0, 120, 124, 3, 24, 12, 0, 121, 124, 3, 20, 10, 0, 122, 124, 5, 22, 0, 0, 123, 120, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 19, 1, 0, 0, 0, 125, 126, 7, 1, 0, 0, 126, 21, 1, 0, 0, 0, 127, 128, 7, 2, 0, 0, 128, 23, 1, 0, 0, 0, 129, 132, 3, 22, 11, 0, 130, 132, 5, 19, 0, 0, 131, 129, 1, 0, 0, 0, 131, 130, 1, 0, 0, 0, 132, 25, 1, 0, 0, 0, 133, 136, 3, 24, 12, 0, 134, 136, 5, 13, 0, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 27, 1, 0, 0, 0, 17, 29, 34, 37, 42, 48, 57, 66, 69, 75, 90, 98, 100, 114, 118, 123, 131, 135] \ No newline at end of file diff --git a/netmap/parser/Query.tokens b/netmap/parser/Query.tokens index 8fdec7d..6376ea2 100644 --- a/netmap/parser/Query.tokens +++ b/netmap/parser/Query.tokens @@ -2,38 +2,40 @@ NOT_OP=1 AND_OP=2 OR_OP=3 SIMPLE_OP=4 -REP=5 -IN=6 -AS=7 -CBF=8 -SELECT=9 -FROM=10 -FILTER=11 -WILDCARD=12 -CLAUSE_SAME=13 -CLAUSE_DISTINCT=14 -L_PAREN=15 -R_PAREN=16 -AT=17 -IDENT=18 -NUMBER1=19 -ZERO=20 -STRING=21 -WS=22 +UNIQUE=5 +REP=6 +IN=7 +AS=8 +CBF=9 +SELECT=10 +FROM=11 +FILTER=12 +WILDCARD=13 +CLAUSE_SAME=14 +CLAUSE_DISTINCT=15 +L_PAREN=16 +R_PAREN=17 +AT=18 +IDENT=19 +NUMBER1=20 +ZERO=21 +STRING=22 +WS=23 'NOT'=1 'AND'=2 'OR'=3 -'REP'=5 -'IN'=6 -'AS'=7 -'CBF'=8 -'SELECT'=9 -'FROM'=10 -'FILTER'=11 -'*'=12 -'SAME'=13 -'DISTINCT'=14 -'('=15 -')'=16 -'@'=17 -'0'=20 +'UNIQUE'=5 +'REP'=6 +'IN'=7 +'AS'=8 +'CBF'=9 +'SELECT'=10 +'FROM'=11 +'FILTER'=12 +'*'=13 +'SAME'=14 +'DISTINCT'=15 +'('=16 +')'=17 +'@'=18 +'0'=21 diff --git a/netmap/parser/QueryLexer.g4 b/netmap/parser/QueryLexer.g4 index f32023c..c9b5ae6 100644 --- a/netmap/parser/QueryLexer.g4 +++ b/netmap/parser/QueryLexer.g4 @@ -5,6 +5,7 @@ AND_OP : 'AND'; OR_OP : 'OR'; SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE'; +UNIQUE : 'UNIQUE'; REP : 'REP'; IN : 'IN'; AS : 'AS'; diff --git a/netmap/parser/QueryLexer.interp b/netmap/parser/QueryLexer.interp index 71b093c..95db144 100644 --- a/netmap/parser/QueryLexer.interp +++ b/netmap/parser/QueryLexer.interp @@ -4,6 +4,7 @@ null 'AND' 'OR' null +'UNIQUE' 'REP' 'IN' 'AS' @@ -29,6 +30,7 @@ NOT_OP AND_OP OR_OP SIMPLE_OP +UNIQUE REP IN AS @@ -53,6 +55,7 @@ NOT_OP AND_OP OR_OP SIMPLE_OP +UNIQUE REP IN AS @@ -87,4 +90,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 22, 204, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 83, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 5, 17, 143, 8, 17, 10, 17, 12, 17, 146, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 5, 20, 154, 8, 20, 10, 20, 12, 20, 157, 9, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 5, 22, 164, 8, 22, 10, 22, 12, 22, 167, 9, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 173, 8, 22, 10, 22, 12, 22, 176, 9, 22, 1, 22, 3, 22, 179, 8, 22, 1, 23, 1, 23, 1, 23, 3, 23, 184, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 4, 28, 199, 8, 28, 11, 28, 12, 28, 200, 1, 28, 1, 28, 0, 0, 29, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 0, 39, 0, 41, 19, 43, 20, 45, 21, 47, 0, 49, 0, 51, 0, 53, 0, 55, 0, 57, 22, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 211, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 1, 59, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0, 5, 67, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 84, 1, 0, 0, 0, 11, 88, 1, 0, 0, 0, 13, 91, 1, 0, 0, 0, 15, 94, 1, 0, 0, 0, 17, 98, 1, 0, 0, 0, 19, 105, 1, 0, 0, 0, 21, 110, 1, 0, 0, 0, 23, 117, 1, 0, 0, 0, 25, 119, 1, 0, 0, 0, 27, 124, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 135, 1, 0, 0, 0, 33, 137, 1, 0, 0, 0, 35, 139, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 149, 1, 0, 0, 0, 41, 151, 1, 0, 0, 0, 43, 158, 1, 0, 0, 0, 45, 178, 1, 0, 0, 0, 47, 180, 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 193, 1, 0, 0, 0, 55, 195, 1, 0, 0, 0, 57, 198, 1, 0, 0, 0, 59, 60, 5, 78, 0, 0, 60, 61, 5, 79, 0, 0, 61, 62, 5, 84, 0, 0, 62, 2, 1, 0, 0, 0, 63, 64, 5, 65, 0, 0, 64, 65, 5, 78, 0, 0, 65, 66, 5, 68, 0, 0, 66, 4, 1, 0, 0, 0, 67, 68, 5, 79, 0, 0, 68, 69, 5, 82, 0, 0, 69, 6, 1, 0, 0, 0, 70, 71, 5, 69, 0, 0, 71, 83, 5, 81, 0, 0, 72, 73, 5, 78, 0, 0, 73, 83, 5, 69, 0, 0, 74, 75, 5, 71, 0, 0, 75, 83, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 83, 5, 84, 0, 0, 78, 79, 5, 76, 0, 0, 79, 83, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 83, 5, 69, 0, 0, 82, 70, 1, 0, 0, 0, 82, 72, 1, 0, 0, 0, 82, 74, 1, 0, 0, 0, 82, 76, 1, 0, 0, 0, 82, 78, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 8, 1, 0, 0, 0, 84, 85, 5, 82, 0, 0, 85, 86, 5, 69, 0, 0, 86, 87, 5, 80, 0, 0, 87, 10, 1, 0, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 78, 0, 0, 90, 12, 1, 0, 0, 0, 91, 92, 5, 65, 0, 0, 92, 93, 5, 83, 0, 0, 93, 14, 1, 0, 0, 0, 94, 95, 5, 67, 0, 0, 95, 96, 5, 66, 0, 0, 96, 97, 5, 70, 0, 0, 97, 16, 1, 0, 0, 0, 98, 99, 5, 83, 0, 0, 99, 100, 5, 69, 0, 0, 100, 101, 5, 76, 0, 0, 101, 102, 5, 69, 0, 0, 102, 103, 5, 67, 0, 0, 103, 104, 5, 84, 0, 0, 104, 18, 1, 0, 0, 0, 105, 106, 5, 70, 0, 0, 106, 107, 5, 82, 0, 0, 107, 108, 5, 79, 0, 0, 108, 109, 5, 77, 0, 0, 109, 20, 1, 0, 0, 0, 110, 111, 5, 70, 0, 0, 111, 112, 5, 73, 0, 0, 112, 113, 5, 76, 0, 0, 113, 114, 5, 84, 0, 0, 114, 115, 5, 69, 0, 0, 115, 116, 5, 82, 0, 0, 116, 22, 1, 0, 0, 0, 117, 118, 5, 42, 0, 0, 118, 24, 1, 0, 0, 0, 119, 120, 5, 83, 0, 0, 120, 121, 5, 65, 0, 0, 121, 122, 5, 77, 0, 0, 122, 123, 5, 69, 0, 0, 123, 26, 1, 0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 73, 0, 0, 126, 127, 5, 83, 0, 0, 127, 128, 5, 84, 0, 0, 128, 129, 5, 73, 0, 0, 129, 130, 5, 78, 0, 0, 130, 131, 5, 67, 0, 0, 131, 132, 5, 84, 0, 0, 132, 28, 1, 0, 0, 0, 133, 134, 5, 40, 0, 0, 134, 30, 1, 0, 0, 0, 135, 136, 5, 41, 0, 0, 136, 32, 1, 0, 0, 0, 137, 138, 5, 64, 0, 0, 138, 34, 1, 0, 0, 0, 139, 144, 3, 39, 19, 0, 140, 143, 3, 37, 18, 0, 141, 143, 3, 39, 19, 0, 142, 140, 1, 0, 0, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 36, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148, 7, 0, 0, 0, 148, 38, 1, 0, 0, 0, 149, 150, 7, 1, 0, 0, 150, 40, 1, 0, 0, 0, 151, 155, 7, 2, 0, 0, 152, 154, 3, 37, 18, 0, 153, 152, 1, 0, 0, 0, 154, 157, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 42, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 158, 159, 5, 48, 0, 0, 159, 44, 1, 0, 0, 0, 160, 165, 5, 34, 0, 0, 161, 164, 3, 47, 23, 0, 162, 164, 3, 55, 27, 0, 163, 161, 1, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 168, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 168, 179, 5, 34, 0, 0, 169, 174, 5, 39, 0, 0, 170, 173, 3, 47, 23, 0, 171, 173, 3, 53, 26, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 179, 5, 39, 0, 0, 178, 160, 1, 0, 0, 0, 178, 169, 1, 0, 0, 0, 179, 46, 1, 0, 0, 0, 180, 183, 5, 92, 0, 0, 181, 184, 7, 3, 0, 0, 182, 184, 3, 49, 24, 0, 183, 181, 1, 0, 0, 0, 183, 182, 1, 0, 0, 0, 184, 48, 1, 0, 0, 0, 185, 186, 5, 117, 0, 0, 186, 187, 3, 51, 25, 0, 187, 188, 3, 51, 25, 0, 188, 189, 3, 51, 25, 0, 189, 190, 3, 51, 25, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 4, 0, 0, 192, 52, 1, 0, 0, 0, 193, 194, 8, 5, 0, 0, 194, 54, 1, 0, 0, 0, 195, 196, 8, 6, 0, 0, 196, 56, 1, 0, 0, 0, 197, 199, 7, 7, 0, 0, 198, 197, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 203, 6, 28, 0, 0, 203, 58, 1, 0, 0, 0, 12, 0, 82, 142, 144, 155, 163, 165, 172, 174, 178, 183, 200, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 23, 213, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 85, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 152, 8, 18, 10, 18, 12, 18, 155, 9, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 5, 21, 163, 8, 21, 10, 21, 12, 21, 166, 9, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 5, 23, 173, 8, 23, 10, 23, 12, 23, 176, 9, 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 182, 8, 23, 10, 23, 12, 23, 185, 9, 23, 1, 23, 3, 23, 188, 8, 23, 1, 24, 1, 24, 1, 24, 3, 24, 193, 8, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 4, 29, 208, 8, 29, 11, 29, 12, 29, 209, 1, 29, 1, 29, 0, 0, 30, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 0, 41, 0, 43, 20, 45, 21, 47, 22, 49, 0, 51, 0, 53, 0, 55, 0, 57, 0, 59, 23, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 220, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 61, 1, 0, 0, 0, 3, 65, 1, 0, 0, 0, 5, 69, 1, 0, 0, 0, 7, 84, 1, 0, 0, 0, 9, 86, 1, 0, 0, 0, 11, 93, 1, 0, 0, 0, 13, 97, 1, 0, 0, 0, 15, 100, 1, 0, 0, 0, 17, 103, 1, 0, 0, 0, 19, 107, 1, 0, 0, 0, 21, 114, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, 126, 1, 0, 0, 0, 27, 128, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 142, 1, 0, 0, 0, 33, 144, 1, 0, 0, 0, 35, 146, 1, 0, 0, 0, 37, 148, 1, 0, 0, 0, 39, 156, 1, 0, 0, 0, 41, 158, 1, 0, 0, 0, 43, 160, 1, 0, 0, 0, 45, 167, 1, 0, 0, 0, 47, 187, 1, 0, 0, 0, 49, 189, 1, 0, 0, 0, 51, 194, 1, 0, 0, 0, 53, 200, 1, 0, 0, 0, 55, 202, 1, 0, 0, 0, 57, 204, 1, 0, 0, 0, 59, 207, 1, 0, 0, 0, 61, 62, 5, 78, 0, 0, 62, 63, 5, 79, 0, 0, 63, 64, 5, 84, 0, 0, 64, 2, 1, 0, 0, 0, 65, 66, 5, 65, 0, 0, 66, 67, 5, 78, 0, 0, 67, 68, 5, 68, 0, 0, 68, 4, 1, 0, 0, 0, 69, 70, 5, 79, 0, 0, 70, 71, 5, 82, 0, 0, 71, 6, 1, 0, 0, 0, 72, 73, 5, 69, 0, 0, 73, 85, 5, 81, 0, 0, 74, 75, 5, 78, 0, 0, 75, 85, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 85, 5, 69, 0, 0, 78, 79, 5, 71, 0, 0, 79, 85, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 85, 5, 84, 0, 0, 82, 83, 5, 76, 0, 0, 83, 85, 5, 69, 0, 0, 84, 72, 1, 0, 0, 0, 84, 74, 1, 0, 0, 0, 84, 76, 1, 0, 0, 0, 84, 78, 1, 0, 0, 0, 84, 80, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 8, 1, 0, 0, 0, 86, 87, 5, 85, 0, 0, 87, 88, 5, 78, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 81, 0, 0, 90, 91, 5, 85, 0, 0, 91, 92, 5, 69, 0, 0, 92, 10, 1, 0, 0, 0, 93, 94, 5, 82, 0, 0, 94, 95, 5, 69, 0, 0, 95, 96, 5, 80, 0, 0, 96, 12, 1, 0, 0, 0, 97, 98, 5, 73, 0, 0, 98, 99, 5, 78, 0, 0, 99, 14, 1, 0, 0, 0, 100, 101, 5, 65, 0, 0, 101, 102, 5, 83, 0, 0, 102, 16, 1, 0, 0, 0, 103, 104, 5, 67, 0, 0, 104, 105, 5, 66, 0, 0, 105, 106, 5, 70, 0, 0, 106, 18, 1, 0, 0, 0, 107, 108, 5, 83, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 76, 0, 0, 110, 111, 5, 69, 0, 0, 111, 112, 5, 67, 0, 0, 112, 113, 5, 84, 0, 0, 113, 20, 1, 0, 0, 0, 114, 115, 5, 70, 0, 0, 115, 116, 5, 82, 0, 0, 116, 117, 5, 79, 0, 0, 117, 118, 5, 77, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 70, 0, 0, 120, 121, 5, 73, 0, 0, 121, 122, 5, 76, 0, 0, 122, 123, 5, 84, 0, 0, 123, 124, 5, 69, 0, 0, 124, 125, 5, 82, 0, 0, 125, 24, 1, 0, 0, 0, 126, 127, 5, 42, 0, 0, 127, 26, 1, 0, 0, 0, 128, 129, 5, 83, 0, 0, 129, 130, 5, 65, 0, 0, 130, 131, 5, 77, 0, 0, 131, 132, 5, 69, 0, 0, 132, 28, 1, 0, 0, 0, 133, 134, 5, 68, 0, 0, 134, 135, 5, 73, 0, 0, 135, 136, 5, 83, 0, 0, 136, 137, 5, 84, 0, 0, 137, 138, 5, 73, 0, 0, 138, 139, 5, 78, 0, 0, 139, 140, 5, 67, 0, 0, 140, 141, 5, 84, 0, 0, 141, 30, 1, 0, 0, 0, 142, 143, 5, 40, 0, 0, 143, 32, 1, 0, 0, 0, 144, 145, 5, 41, 0, 0, 145, 34, 1, 0, 0, 0, 146, 147, 5, 64, 0, 0, 147, 36, 1, 0, 0, 0, 148, 153, 3, 41, 20, 0, 149, 152, 3, 39, 19, 0, 150, 152, 3, 41, 20, 0, 151, 149, 1, 0, 0, 0, 151, 150, 1, 0, 0, 0, 152, 155, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 38, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 156, 157, 7, 0, 0, 0, 157, 40, 1, 0, 0, 0, 158, 159, 7, 1, 0, 0, 159, 42, 1, 0, 0, 0, 160, 164, 7, 2, 0, 0, 161, 163, 3, 39, 19, 0, 162, 161, 1, 0, 0, 0, 163, 166, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 44, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 167, 168, 5, 48, 0, 0, 168, 46, 1, 0, 0, 0, 169, 174, 5, 34, 0, 0, 170, 173, 3, 49, 24, 0, 171, 173, 3, 57, 28, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 188, 5, 34, 0, 0, 178, 183, 5, 39, 0, 0, 179, 182, 3, 49, 24, 0, 180, 182, 3, 55, 27, 0, 181, 179, 1, 0, 0, 0, 181, 180, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 186, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 188, 5, 39, 0, 0, 187, 169, 1, 0, 0, 0, 187, 178, 1, 0, 0, 0, 188, 48, 1, 0, 0, 0, 189, 192, 5, 92, 0, 0, 190, 193, 7, 3, 0, 0, 191, 193, 3, 51, 25, 0, 192, 190, 1, 0, 0, 0, 192, 191, 1, 0, 0, 0, 193, 50, 1, 0, 0, 0, 194, 195, 5, 117, 0, 0, 195, 196, 3, 53, 26, 0, 196, 197, 3, 53, 26, 0, 197, 198, 3, 53, 26, 0, 198, 199, 3, 53, 26, 0, 199, 52, 1, 0, 0, 0, 200, 201, 7, 4, 0, 0, 201, 54, 1, 0, 0, 0, 202, 203, 8, 5, 0, 0, 203, 56, 1, 0, 0, 0, 204, 205, 8, 6, 0, 0, 205, 58, 1, 0, 0, 0, 206, 208, 7, 7, 0, 0, 207, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 212, 6, 29, 0, 0, 212, 60, 1, 0, 0, 0, 12, 0, 84, 151, 153, 164, 172, 174, 181, 183, 187, 192, 209, 1, 6, 0, 0] \ No newline at end of file diff --git a/netmap/parser/QueryLexer.tokens b/netmap/parser/QueryLexer.tokens index 8fdec7d..6376ea2 100644 --- a/netmap/parser/QueryLexer.tokens +++ b/netmap/parser/QueryLexer.tokens @@ -2,38 +2,40 @@ NOT_OP=1 AND_OP=2 OR_OP=3 SIMPLE_OP=4 -REP=5 -IN=6 -AS=7 -CBF=8 -SELECT=9 -FROM=10 -FILTER=11 -WILDCARD=12 -CLAUSE_SAME=13 -CLAUSE_DISTINCT=14 -L_PAREN=15 -R_PAREN=16 -AT=17 -IDENT=18 -NUMBER1=19 -ZERO=20 -STRING=21 -WS=22 +UNIQUE=5 +REP=6 +IN=7 +AS=8 +CBF=9 +SELECT=10 +FROM=11 +FILTER=12 +WILDCARD=13 +CLAUSE_SAME=14 +CLAUSE_DISTINCT=15 +L_PAREN=16 +R_PAREN=17 +AT=18 +IDENT=19 +NUMBER1=20 +ZERO=21 +STRING=22 +WS=23 'NOT'=1 'AND'=2 'OR'=3 -'REP'=5 -'IN'=6 -'AS'=7 -'CBF'=8 -'SELECT'=9 -'FROM'=10 -'FILTER'=11 -'*'=12 -'SAME'=13 -'DISTINCT'=14 -'('=15 -')'=16 -'@'=17 -'0'=20 +'UNIQUE'=5 +'REP'=6 +'IN'=7 +'AS'=8 +'CBF'=9 +'SELECT'=10 +'FROM'=11 +'FILTER'=12 +'*'=13 +'SAME'=14 +'DISTINCT'=15 +'('=16 +')'=17 +'@'=18 +'0'=21 diff --git a/netmap/parser/generate.go b/netmap/parser/generate.go index f2202d2..66a855b 100644 --- a/netmap/parser/generate.go +++ b/netmap/parser/generate.go @@ -1,4 +1,4 @@ package parser -// ANTLR can be downloaded from https://www.antlr.org/download/antlr-4.12.0-complete.jar -//go:generate java -Xmx500M -cp "./antlr-4.12.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -no-listener -visitor QueryLexer.g4 Query.g4 +// ANTLR can be downloaded from https://www.antlr.org/download/antlr-4.13.0-complete.jar +//go:generate java -Xmx500M -cp "./antlr-4.13.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -no-listener -visitor QueryLexer.g4 Query.g4 diff --git a/netmap/parser/query_base_visitor.go b/netmap/parser/query_base_visitor.go index fa1cce8..4badbce 100644 --- a/netmap/parser/query_base_visitor.go +++ b/netmap/parser/query_base_visitor.go @@ -1,3 +1,5 @@ +// Code generated from Query.g4 by ANTLR 4.13.0. DO NOT EDIT. + package parser // Query import "github.com/antlr4-go/antlr/v4" diff --git a/netmap/parser/query_lexer.go b/netmap/parser/query_lexer.go index b9224b6..c1ae141 100644 --- a/netmap/parser/query_lexer.go +++ b/netmap/parser/query_lexer.go @@ -1,11 +1,12 @@ +// Code generated from QueryLexer.g4 by ANTLR 4.13.0. DO NOT EDIT. + package parser import ( "fmt" + "github.com/antlr4-go/antlr/v4" "sync" "unicode" - - "github.com/antlr4-go/antlr/v4" ) // Suppress unused import error @@ -42,114 +43,119 @@ func querylexerLexerInit() { "DEFAULT_MODE", } staticData.LiteralNames = []string{ - "", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", - "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", - "')'", "'@'", "", "", "'0'", + "", "'NOT'", "'AND'", "'OR'", "", "'UNIQUE'", "'REP'", "'IN'", "'AS'", + "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", + "'('", "')'", "'@'", "", "", "'0'", } staticData.SymbolicNames = []string{ - "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", - "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", - "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", + "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "IN", + "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", + "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", + "STRING", "WS", } staticData.RuleNames = []string{ - "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", - "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", + "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "IN", "AS", + "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", "WS", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 22, 204, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, + 4, 0, 23, 213, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, - 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 83, 8, 3, 1, 4, 1, 4, 1, 4, 1, - 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, - 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, - 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, - 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, - 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 5, 17, - 143, 8, 17, 10, 17, 12, 17, 146, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, - 20, 1, 20, 5, 20, 154, 8, 20, 10, 20, 12, 20, 157, 9, 20, 1, 21, 1, 21, - 1, 22, 1, 22, 1, 22, 5, 22, 164, 8, 22, 10, 22, 12, 22, 167, 9, 22, 1, - 22, 1, 22, 1, 22, 1, 22, 5, 22, 173, 8, 22, 10, 22, 12, 22, 176, 9, 22, - 1, 22, 3, 22, 179, 8, 22, 1, 23, 1, 23, 1, 23, 3, 23, 184, 8, 23, 1, 24, - 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, - 27, 1, 28, 4, 28, 199, 8, 28, 11, 28, 12, 28, 200, 1, 28, 1, 28, 0, 0, - 29, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, - 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 0, 39, - 0, 41, 19, 43, 20, 45, 21, 47, 0, 49, 0, 51, 0, 53, 0, 55, 0, 57, 22, 1, - 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, - 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, - 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, - 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 211, 0, 1, 1, 0, 0, - 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, - 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, - 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, - 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, - 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, - 45, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 1, 59, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0, - 5, 67, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 84, 1, 0, 0, 0, 11, 88, 1, 0, - 0, 0, 13, 91, 1, 0, 0, 0, 15, 94, 1, 0, 0, 0, 17, 98, 1, 0, 0, 0, 19, 105, - 1, 0, 0, 0, 21, 110, 1, 0, 0, 0, 23, 117, 1, 0, 0, 0, 25, 119, 1, 0, 0, - 0, 27, 124, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 135, 1, 0, 0, 0, 33, 137, - 1, 0, 0, 0, 35, 139, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 149, 1, 0, 0, - 0, 41, 151, 1, 0, 0, 0, 43, 158, 1, 0, 0, 0, 45, 178, 1, 0, 0, 0, 47, 180, - 1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 193, 1, 0, 0, - 0, 55, 195, 1, 0, 0, 0, 57, 198, 1, 0, 0, 0, 59, 60, 5, 78, 0, 0, 60, 61, - 5, 79, 0, 0, 61, 62, 5, 84, 0, 0, 62, 2, 1, 0, 0, 0, 63, 64, 5, 65, 0, - 0, 64, 65, 5, 78, 0, 0, 65, 66, 5, 68, 0, 0, 66, 4, 1, 0, 0, 0, 67, 68, - 5, 79, 0, 0, 68, 69, 5, 82, 0, 0, 69, 6, 1, 0, 0, 0, 70, 71, 5, 69, 0, - 0, 71, 83, 5, 81, 0, 0, 72, 73, 5, 78, 0, 0, 73, 83, 5, 69, 0, 0, 74, 75, - 5, 71, 0, 0, 75, 83, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 83, 5, 84, 0, - 0, 78, 79, 5, 76, 0, 0, 79, 83, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 83, - 5, 69, 0, 0, 82, 70, 1, 0, 0, 0, 82, 72, 1, 0, 0, 0, 82, 74, 1, 0, 0, 0, - 82, 76, 1, 0, 0, 0, 82, 78, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 8, 1, 0, - 0, 0, 84, 85, 5, 82, 0, 0, 85, 86, 5, 69, 0, 0, 86, 87, 5, 80, 0, 0, 87, - 10, 1, 0, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 78, 0, 0, 90, 12, 1, 0, - 0, 0, 91, 92, 5, 65, 0, 0, 92, 93, 5, 83, 0, 0, 93, 14, 1, 0, 0, 0, 94, - 95, 5, 67, 0, 0, 95, 96, 5, 66, 0, 0, 96, 97, 5, 70, 0, 0, 97, 16, 1, 0, - 0, 0, 98, 99, 5, 83, 0, 0, 99, 100, 5, 69, 0, 0, 100, 101, 5, 76, 0, 0, - 101, 102, 5, 69, 0, 0, 102, 103, 5, 67, 0, 0, 103, 104, 5, 84, 0, 0, 104, - 18, 1, 0, 0, 0, 105, 106, 5, 70, 0, 0, 106, 107, 5, 82, 0, 0, 107, 108, - 5, 79, 0, 0, 108, 109, 5, 77, 0, 0, 109, 20, 1, 0, 0, 0, 110, 111, 5, 70, - 0, 0, 111, 112, 5, 73, 0, 0, 112, 113, 5, 76, 0, 0, 113, 114, 5, 84, 0, - 0, 114, 115, 5, 69, 0, 0, 115, 116, 5, 82, 0, 0, 116, 22, 1, 0, 0, 0, 117, - 118, 5, 42, 0, 0, 118, 24, 1, 0, 0, 0, 119, 120, 5, 83, 0, 0, 120, 121, - 5, 65, 0, 0, 121, 122, 5, 77, 0, 0, 122, 123, 5, 69, 0, 0, 123, 26, 1, - 0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 73, 0, 0, 126, 127, 5, 83, - 0, 0, 127, 128, 5, 84, 0, 0, 128, 129, 5, 73, 0, 0, 129, 130, 5, 78, 0, - 0, 130, 131, 5, 67, 0, 0, 131, 132, 5, 84, 0, 0, 132, 28, 1, 0, 0, 0, 133, - 134, 5, 40, 0, 0, 134, 30, 1, 0, 0, 0, 135, 136, 5, 41, 0, 0, 136, 32, - 1, 0, 0, 0, 137, 138, 5, 64, 0, 0, 138, 34, 1, 0, 0, 0, 139, 144, 3, 39, - 19, 0, 140, 143, 3, 37, 18, 0, 141, 143, 3, 39, 19, 0, 142, 140, 1, 0, - 0, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, - 144, 145, 1, 0, 0, 0, 145, 36, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148, - 7, 0, 0, 0, 148, 38, 1, 0, 0, 0, 149, 150, 7, 1, 0, 0, 150, 40, 1, 0, 0, - 0, 151, 155, 7, 2, 0, 0, 152, 154, 3, 37, 18, 0, 153, 152, 1, 0, 0, 0, - 154, 157, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, - 42, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 158, 159, 5, 48, 0, 0, 159, 44, 1, - 0, 0, 0, 160, 165, 5, 34, 0, 0, 161, 164, 3, 47, 23, 0, 162, 164, 3, 55, - 27, 0, 163, 161, 1, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, - 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 168, 1, 0, 0, 0, 167, - 165, 1, 0, 0, 0, 168, 179, 5, 34, 0, 0, 169, 174, 5, 39, 0, 0, 170, 173, - 3, 47, 23, 0, 171, 173, 3, 53, 26, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1, - 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, - 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 179, 5, 39, 0, 0, 178, - 160, 1, 0, 0, 0, 178, 169, 1, 0, 0, 0, 179, 46, 1, 0, 0, 0, 180, 183, 5, - 92, 0, 0, 181, 184, 7, 3, 0, 0, 182, 184, 3, 49, 24, 0, 183, 181, 1, 0, - 0, 0, 183, 182, 1, 0, 0, 0, 184, 48, 1, 0, 0, 0, 185, 186, 5, 117, 0, 0, - 186, 187, 3, 51, 25, 0, 187, 188, 3, 51, 25, 0, 188, 189, 3, 51, 25, 0, - 189, 190, 3, 51, 25, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 4, 0, 0, 192, - 52, 1, 0, 0, 0, 193, 194, 8, 5, 0, 0, 194, 54, 1, 0, 0, 0, 195, 196, 8, - 6, 0, 0, 196, 56, 1, 0, 0, 0, 197, 199, 7, 7, 0, 0, 198, 197, 1, 0, 0, - 0, 199, 200, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, - 202, 1, 0, 0, 0, 202, 203, 6, 28, 0, 0, 203, 58, 1, 0, 0, 0, 12, 0, 82, - 142, 144, 155, 163, 165, 172, 174, 178, 183, 200, 1, 6, 0, 0, + 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, + 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 85, 8, 3, 1, 4, + 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, + 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, + 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, + 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, + 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, + 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 152, 8, + 18, 10, 18, 12, 18, 155, 9, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, + 5, 21, 163, 8, 21, 10, 21, 12, 21, 166, 9, 21, 1, 22, 1, 22, 1, 23, 1, + 23, 1, 23, 5, 23, 173, 8, 23, 10, 23, 12, 23, 176, 9, 23, 1, 23, 1, 23, + 1, 23, 1, 23, 5, 23, 182, 8, 23, 10, 23, 12, 23, 185, 9, 23, 1, 23, 3, + 23, 188, 8, 23, 1, 24, 1, 24, 1, 24, 3, 24, 193, 8, 24, 1, 25, 1, 25, 1, + 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, + 4, 29, 208, 8, 29, 11, 29, 12, 29, 209, 1, 29, 1, 29, 0, 0, 30, 1, 1, 3, + 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, + 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 0, 41, 0, 43, + 20, 45, 21, 47, 22, 49, 0, 51, 0, 53, 0, 55, 0, 57, 0, 59, 23, 1, 0, 8, + 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, + 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, + 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, + 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 220, 0, 1, 1, 0, 0, 0, 0, + 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, + 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, + 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, + 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, + 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, + 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 61, 1, 0, 0, 0, 3, 65, + 1, 0, 0, 0, 5, 69, 1, 0, 0, 0, 7, 84, 1, 0, 0, 0, 9, 86, 1, 0, 0, 0, 11, + 93, 1, 0, 0, 0, 13, 97, 1, 0, 0, 0, 15, 100, 1, 0, 0, 0, 17, 103, 1, 0, + 0, 0, 19, 107, 1, 0, 0, 0, 21, 114, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, + 126, 1, 0, 0, 0, 27, 128, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 142, 1, + 0, 0, 0, 33, 144, 1, 0, 0, 0, 35, 146, 1, 0, 0, 0, 37, 148, 1, 0, 0, 0, + 39, 156, 1, 0, 0, 0, 41, 158, 1, 0, 0, 0, 43, 160, 1, 0, 0, 0, 45, 167, + 1, 0, 0, 0, 47, 187, 1, 0, 0, 0, 49, 189, 1, 0, 0, 0, 51, 194, 1, 0, 0, + 0, 53, 200, 1, 0, 0, 0, 55, 202, 1, 0, 0, 0, 57, 204, 1, 0, 0, 0, 59, 207, + 1, 0, 0, 0, 61, 62, 5, 78, 0, 0, 62, 63, 5, 79, 0, 0, 63, 64, 5, 84, 0, + 0, 64, 2, 1, 0, 0, 0, 65, 66, 5, 65, 0, 0, 66, 67, 5, 78, 0, 0, 67, 68, + 5, 68, 0, 0, 68, 4, 1, 0, 0, 0, 69, 70, 5, 79, 0, 0, 70, 71, 5, 82, 0, + 0, 71, 6, 1, 0, 0, 0, 72, 73, 5, 69, 0, 0, 73, 85, 5, 81, 0, 0, 74, 75, + 5, 78, 0, 0, 75, 85, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 85, 5, 69, 0, + 0, 78, 79, 5, 71, 0, 0, 79, 85, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 85, + 5, 84, 0, 0, 82, 83, 5, 76, 0, 0, 83, 85, 5, 69, 0, 0, 84, 72, 1, 0, 0, + 0, 84, 74, 1, 0, 0, 0, 84, 76, 1, 0, 0, 0, 84, 78, 1, 0, 0, 0, 84, 80, + 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 8, 1, 0, 0, 0, 86, 87, 5, 85, 0, 0, + 87, 88, 5, 78, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 81, 0, 0, 90, 91, + 5, 85, 0, 0, 91, 92, 5, 69, 0, 0, 92, 10, 1, 0, 0, 0, 93, 94, 5, 82, 0, + 0, 94, 95, 5, 69, 0, 0, 95, 96, 5, 80, 0, 0, 96, 12, 1, 0, 0, 0, 97, 98, + 5, 73, 0, 0, 98, 99, 5, 78, 0, 0, 99, 14, 1, 0, 0, 0, 100, 101, 5, 65, + 0, 0, 101, 102, 5, 83, 0, 0, 102, 16, 1, 0, 0, 0, 103, 104, 5, 67, 0, 0, + 104, 105, 5, 66, 0, 0, 105, 106, 5, 70, 0, 0, 106, 18, 1, 0, 0, 0, 107, + 108, 5, 83, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 76, 0, 0, 110, 111, + 5, 69, 0, 0, 111, 112, 5, 67, 0, 0, 112, 113, 5, 84, 0, 0, 113, 20, 1, + 0, 0, 0, 114, 115, 5, 70, 0, 0, 115, 116, 5, 82, 0, 0, 116, 117, 5, 79, + 0, 0, 117, 118, 5, 77, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 70, 0, 0, + 120, 121, 5, 73, 0, 0, 121, 122, 5, 76, 0, 0, 122, 123, 5, 84, 0, 0, 123, + 124, 5, 69, 0, 0, 124, 125, 5, 82, 0, 0, 125, 24, 1, 0, 0, 0, 126, 127, + 5, 42, 0, 0, 127, 26, 1, 0, 0, 0, 128, 129, 5, 83, 0, 0, 129, 130, 5, 65, + 0, 0, 130, 131, 5, 77, 0, 0, 131, 132, 5, 69, 0, 0, 132, 28, 1, 0, 0, 0, + 133, 134, 5, 68, 0, 0, 134, 135, 5, 73, 0, 0, 135, 136, 5, 83, 0, 0, 136, + 137, 5, 84, 0, 0, 137, 138, 5, 73, 0, 0, 138, 139, 5, 78, 0, 0, 139, 140, + 5, 67, 0, 0, 140, 141, 5, 84, 0, 0, 141, 30, 1, 0, 0, 0, 142, 143, 5, 40, + 0, 0, 143, 32, 1, 0, 0, 0, 144, 145, 5, 41, 0, 0, 145, 34, 1, 0, 0, 0, + 146, 147, 5, 64, 0, 0, 147, 36, 1, 0, 0, 0, 148, 153, 3, 41, 20, 0, 149, + 152, 3, 39, 19, 0, 150, 152, 3, 41, 20, 0, 151, 149, 1, 0, 0, 0, 151, 150, + 1, 0, 0, 0, 152, 155, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, + 0, 0, 154, 38, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 156, 157, 7, 0, 0, 0, + 157, 40, 1, 0, 0, 0, 158, 159, 7, 1, 0, 0, 159, 42, 1, 0, 0, 0, 160, 164, + 7, 2, 0, 0, 161, 163, 3, 39, 19, 0, 162, 161, 1, 0, 0, 0, 163, 166, 1, + 0, 0, 0, 164, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 44, 1, 0, 0, + 0, 166, 164, 1, 0, 0, 0, 167, 168, 5, 48, 0, 0, 168, 46, 1, 0, 0, 0, 169, + 174, 5, 34, 0, 0, 170, 173, 3, 49, 24, 0, 171, 173, 3, 57, 28, 0, 172, + 170, 1, 0, 0, 0, 172, 171, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, + 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, + 0, 0, 177, 188, 5, 34, 0, 0, 178, 183, 5, 39, 0, 0, 179, 182, 3, 49, 24, + 0, 180, 182, 3, 55, 27, 0, 181, 179, 1, 0, 0, 0, 181, 180, 1, 0, 0, 0, + 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, + 186, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 188, 5, 39, 0, 0, 187, 169, + 1, 0, 0, 0, 187, 178, 1, 0, 0, 0, 188, 48, 1, 0, 0, 0, 189, 192, 5, 92, + 0, 0, 190, 193, 7, 3, 0, 0, 191, 193, 3, 51, 25, 0, 192, 190, 1, 0, 0, + 0, 192, 191, 1, 0, 0, 0, 193, 50, 1, 0, 0, 0, 194, 195, 5, 117, 0, 0, 195, + 196, 3, 53, 26, 0, 196, 197, 3, 53, 26, 0, 197, 198, 3, 53, 26, 0, 198, + 199, 3, 53, 26, 0, 199, 52, 1, 0, 0, 0, 200, 201, 7, 4, 0, 0, 201, 54, + 1, 0, 0, 0, 202, 203, 8, 5, 0, 0, 203, 56, 1, 0, 0, 0, 204, 205, 8, 6, + 0, 0, 205, 58, 1, 0, 0, 0, 206, 208, 7, 7, 0, 0, 207, 206, 1, 0, 0, 0, + 208, 209, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, + 211, 1, 0, 0, 0, 211, 212, 6, 29, 0, 0, 212, 60, 1, 0, 0, 0, 12, 0, 84, + 151, 153, 164, 172, 174, 181, 183, 187, 192, 209, 1, 6, 0, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -194,22 +200,23 @@ const ( QueryLexerAND_OP = 2 QueryLexerOR_OP = 3 QueryLexerSIMPLE_OP = 4 - QueryLexerREP = 5 - QueryLexerIN = 6 - QueryLexerAS = 7 - QueryLexerCBF = 8 - QueryLexerSELECT = 9 - QueryLexerFROM = 10 - QueryLexerFILTER = 11 - QueryLexerWILDCARD = 12 - QueryLexerCLAUSE_SAME = 13 - QueryLexerCLAUSE_DISTINCT = 14 - QueryLexerL_PAREN = 15 - QueryLexerR_PAREN = 16 - QueryLexerAT = 17 - QueryLexerIDENT = 18 - QueryLexerNUMBER1 = 19 - QueryLexerZERO = 20 - QueryLexerSTRING = 21 - QueryLexerWS = 22 + QueryLexerUNIQUE = 5 + QueryLexerREP = 6 + QueryLexerIN = 7 + QueryLexerAS = 8 + QueryLexerCBF = 9 + QueryLexerSELECT = 10 + QueryLexerFROM = 11 + QueryLexerFILTER = 12 + QueryLexerWILDCARD = 13 + QueryLexerCLAUSE_SAME = 14 + QueryLexerCLAUSE_DISTINCT = 15 + QueryLexerL_PAREN = 16 + QueryLexerR_PAREN = 17 + QueryLexerAT = 18 + QueryLexerIDENT = 19 + QueryLexerNUMBER1 = 20 + QueryLexerZERO = 21 + QueryLexerSTRING = 22 + QueryLexerWS = 23 ) diff --git a/netmap/parser/query_parser.go b/netmap/parser/query_parser.go index 3dda93e..6357727 100644 --- a/netmap/parser/query_parser.go +++ b/netmap/parser/query_parser.go @@ -1,3 +1,5 @@ +// Code generated from Query.g4 by ANTLR 4.13.0. DO NOT EDIT. + package parser // Query import ( @@ -31,14 +33,15 @@ var QueryParserStaticData struct { func queryParserInit() { staticData := &QueryParserStaticData staticData.LiteralNames = []string{ - "", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", - "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", - "')'", "'@'", "", "", "'0'", + "", "'NOT'", "'AND'", "'OR'", "", "'UNIQUE'", "'REP'", "'IN'", "'AS'", + "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", + "'('", "')'", "'@'", "", "", "'0'", } staticData.SymbolicNames = []string{ - "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", - "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", - "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", + "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "IN", + "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", + "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", + "STRING", "WS", } staticData.RuleNames = []string{ "policy", "repStmt", "cbfStmt", "selectStmt", "clause", "filterExpr", @@ -47,62 +50,64 @@ func queryParserInit() { } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 22, 135, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 23, 138, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, - 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11, - 0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0, - 41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, - 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, - 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, - 1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, - 5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, - 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 112, 8, 7, 1, 8, 1, 8, 3, 8, 116, 8, - 8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, - 1, 12, 3, 12, 129, 8, 12, 1, 13, 1, 13, 3, 13, 133, 8, 13, 1, 13, 0, 1, - 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, - 13, 14, 1, 0, 19, 20, 2, 0, 5, 7, 9, 11, 138, 0, 29, 1, 0, 0, 0, 2, 50, - 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, - 87, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 115, 1, 0, - 0, 0, 18, 120, 1, 0, 0, 0, 20, 122, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24, - 128, 1, 0, 0, 0, 26, 132, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, - 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, - 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, - 35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, - 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, - 39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, - 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, - 1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 5, 0, 0, - 51, 54, 5, 19, 0, 0, 52, 53, 5, 6, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, - 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 8, 0, 0, - 57, 58, 5, 19, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 66, 5, - 19, 0, 0, 61, 63, 5, 6, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, - 64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, - 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 10, 0, 0, 69, - 72, 3, 26, 13, 0, 70, 71, 5, 7, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, - 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, - 9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 1, 0, 0, 78, 79, 5, 15, - 0, 0, 79, 80, 3, 10, 5, 0, 80, 81, 5, 16, 0, 0, 81, 88, 1, 0, 0, 0, 82, - 83, 5, 15, 0, 0, 83, 84, 3, 10, 5, 0, 84, 85, 5, 16, 0, 0, 85, 88, 1, 0, - 0, 0, 86, 88, 3, 14, 7, 0, 87, 76, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 87, - 86, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 5, 2, - 0, 0, 91, 96, 3, 10, 5, 5, 92, 93, 10, 3, 0, 0, 93, 94, 5, 3, 0, 0, 94, - 96, 3, 10, 5, 4, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0, - 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 11, 1, 0, 0, 0, 99, 97, - 1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 3, 10, 5, 0, 102, 103, 5, - 7, 0, 0, 103, 104, 3, 24, 12, 0, 104, 13, 1, 0, 0, 0, 105, 106, 5, 17, - 0, 0, 106, 112, 3, 24, 12, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 4, 0, - 0, 109, 110, 3, 18, 9, 0, 110, 112, 1, 0, 0, 0, 111, 105, 1, 0, 0, 0, 111, - 107, 1, 0, 0, 0, 112, 15, 1, 0, 0, 0, 113, 116, 3, 24, 12, 0, 114, 116, - 5, 21, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0, - 0, 0, 117, 121, 3, 24, 12, 0, 118, 121, 3, 20, 10, 0, 119, 121, 5, 21, - 0, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, - 121, 19, 1, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 21, 1, 0, 0, 0, 124, 125, - 7, 2, 0, 0, 125, 23, 1, 0, 0, 0, 126, 129, 3, 22, 11, 0, 127, 129, 5, 18, - 0, 0, 128, 126, 1, 0, 0, 0, 128, 127, 1, 0, 0, 0, 129, 25, 1, 0, 0, 0, - 130, 133, 3, 24, 12, 0, 131, 133, 5, 12, 0, 0, 132, 130, 1, 0, 0, 0, 132, - 131, 1, 0, 0, 0, 133, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, - 87, 95, 97, 111, 115, 120, 128, 132, + 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 3, 0, 30, 8, 0, 1, + 0, 4, 0, 33, 8, 0, 11, 0, 12, 0, 34, 1, 0, 3, 0, 38, 8, 0, 1, 0, 5, 0, + 41, 8, 0, 10, 0, 12, 0, 44, 9, 0, 1, 0, 5, 0, 47, 8, 0, 10, 0, 12, 0, 50, + 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 58, 8, 1, 1, 2, 1, 2, 1, + 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 3, 3, 70, 8, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 3, 3, 76, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, + 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 91, 8, 5, 1, 5, 1, 5, 1, 5, + 1, 5, 1, 5, 1, 5, 5, 5, 99, 8, 5, 10, 5, 12, 5, 102, 9, 5, 1, 6, 1, 6, + 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 115, 8, 7, + 1, 8, 1, 8, 3, 8, 119, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 124, 8, 9, 1, 10, + 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 132, 8, 12, 1, 13, 1, 13, 3, + 13, 136, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, + 20, 22, 24, 26, 0, 3, 1, 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 142, + 0, 29, 1, 0, 0, 0, 2, 53, 1, 0, 0, 0, 4, 59, 1, 0, 0, 0, 6, 62, 1, 0, 0, + 0, 8, 77, 1, 0, 0, 0, 10, 90, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 114, + 1, 0, 0, 0, 16, 118, 1, 0, 0, 0, 18, 123, 1, 0, 0, 0, 20, 125, 1, 0, 0, + 0, 22, 127, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 135, 1, 0, 0, 0, 28, 30, + 5, 5, 0, 0, 29, 28, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 32, 1, 0, 0, 0, + 31, 33, 3, 2, 1, 0, 32, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 32, 1, + 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 3, 4, 2, 0, 37, + 36, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 42, 1, 0, 0, 0, 39, 41, 3, 6, 3, + 0, 40, 39, 1, 0, 0, 0, 41, 44, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 43, + 1, 0, 0, 0, 43, 48, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 45, 47, 3, 12, 6, 0, + 46, 45, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, + 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 52, 5, 0, 0, 1, 52, + 1, 1, 0, 0, 0, 53, 54, 5, 6, 0, 0, 54, 57, 5, 20, 0, 0, 55, 56, 5, 7, 0, + 0, 56, 58, 3, 24, 12, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 3, + 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 61, 5, 20, 0, 0, 61, 5, 1, 0, 0, 0, + 62, 63, 5, 10, 0, 0, 63, 69, 5, 20, 0, 0, 64, 66, 5, 7, 0, 0, 65, 67, 3, + 8, 4, 0, 66, 65, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, + 70, 3, 24, 12, 0, 69, 64, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, + 0, 0, 71, 72, 5, 11, 0, 0, 72, 75, 3, 26, 13, 0, 73, 74, 5, 8, 0, 0, 74, + 76, 3, 24, 12, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 7, 1, 0, + 0, 0, 77, 78, 7, 0, 0, 0, 78, 9, 1, 0, 0, 0, 79, 80, 6, 5, -1, 0, 80, 81, + 5, 1, 0, 0, 81, 82, 5, 16, 0, 0, 82, 83, 3, 10, 5, 0, 83, 84, 5, 17, 0, + 0, 84, 91, 1, 0, 0, 0, 85, 86, 5, 16, 0, 0, 86, 87, 3, 10, 5, 0, 87, 88, + 5, 17, 0, 0, 88, 91, 1, 0, 0, 0, 89, 91, 3, 14, 7, 0, 90, 79, 1, 0, 0, + 0, 90, 85, 1, 0, 0, 0, 90, 89, 1, 0, 0, 0, 91, 100, 1, 0, 0, 0, 92, 93, + 10, 4, 0, 0, 93, 94, 5, 2, 0, 0, 94, 99, 3, 10, 5, 5, 95, 96, 10, 3, 0, + 0, 96, 97, 5, 3, 0, 0, 97, 99, 3, 10, 5, 4, 98, 92, 1, 0, 0, 0, 98, 95, + 1, 0, 0, 0, 99, 102, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, + 0, 101, 11, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 103, 104, 5, 12, 0, 0, 104, + 105, 3, 10, 5, 0, 105, 106, 5, 8, 0, 0, 106, 107, 3, 24, 12, 0, 107, 13, + 1, 0, 0, 0, 108, 109, 5, 18, 0, 0, 109, 115, 3, 24, 12, 0, 110, 111, 3, + 16, 8, 0, 111, 112, 5, 4, 0, 0, 112, 113, 3, 18, 9, 0, 113, 115, 1, 0, + 0, 0, 114, 108, 1, 0, 0, 0, 114, 110, 1, 0, 0, 0, 115, 15, 1, 0, 0, 0, + 116, 119, 3, 24, 12, 0, 117, 119, 5, 22, 0, 0, 118, 116, 1, 0, 0, 0, 118, + 117, 1, 0, 0, 0, 119, 17, 1, 0, 0, 0, 120, 124, 3, 24, 12, 0, 121, 124, + 3, 20, 10, 0, 122, 124, 5, 22, 0, 0, 123, 120, 1, 0, 0, 0, 123, 121, 1, + 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 19, 1, 0, 0, 0, 125, 126, 7, 1, 0, + 0, 126, 21, 1, 0, 0, 0, 127, 128, 7, 2, 0, 0, 128, 23, 1, 0, 0, 0, 129, + 132, 3, 22, 11, 0, 130, 132, 5, 19, 0, 0, 131, 129, 1, 0, 0, 0, 131, 130, + 1, 0, 0, 0, 132, 25, 1, 0, 0, 0, 133, 136, 3, 24, 12, 0, 134, 136, 5, 13, + 0, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 27, 1, 0, 0, 0, + 17, 29, 34, 37, 42, 48, 57, 66, 69, 75, 90, 98, 100, 114, 118, 123, 131, + 135, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -145,24 +150,25 @@ const ( QueryAND_OP = 2 QueryOR_OP = 3 QuerySIMPLE_OP = 4 - QueryREP = 5 - QueryIN = 6 - QueryAS = 7 - QueryCBF = 8 - QuerySELECT = 9 - QueryFROM = 10 - QueryFILTER = 11 - QueryWILDCARD = 12 - QueryCLAUSE_SAME = 13 - QueryCLAUSE_DISTINCT = 14 - QueryL_PAREN = 15 - QueryR_PAREN = 16 - QueryAT = 17 - QueryIDENT = 18 - QueryNUMBER1 = 19 - QueryZERO = 20 - QuerySTRING = 21 - QueryWS = 22 + QueryUNIQUE = 5 + QueryREP = 6 + QueryIN = 7 + QueryAS = 8 + QueryCBF = 9 + QuerySELECT = 10 + QueryFROM = 11 + QueryFILTER = 12 + QueryWILDCARD = 13 + QueryCLAUSE_SAME = 14 + QueryCLAUSE_DISTINCT = 15 + QueryL_PAREN = 16 + QueryR_PAREN = 17 + QueryAT = 18 + QueryIDENT = 19 + QueryNUMBER1 = 20 + QueryZERO = 21 + QuerySTRING = 22 + QueryWS = 23 ) // Query rules. @@ -192,6 +198,7 @@ type IPolicyContext interface { // Getter signatures EOF() antlr.TerminalNode + UNIQUE() antlr.TerminalNode AllRepStmt() []IRepStmtContext RepStmt(i int) IRepStmtContext CbfStmt() ICbfStmtContext @@ -240,6 +247,10 @@ func (s *PolicyContext) EOF() antlr.TerminalNode { return s.GetToken(QueryEOF, 0) } +func (s *PolicyContext) UNIQUE() antlr.TerminalNode { + return s.GetToken(QueryUNIQUE, 0) +} + func (s *PolicyContext) AllRepStmt() []IRepStmtContext { children := s.GetChildren() len := 0 @@ -410,20 +421,38 @@ func (p *Query) Policy() (localctx IPolicyContext) { } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = _la == QueryREP { + if _la == QueryUNIQUE { { p.SetState(28) + p.Match(QueryUNIQUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(32) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == QueryREP { + { + p.SetState(31) p.RepStmt() } - p.SetState(31) + p.SetState(34) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(34) + p.SetState(37) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -432,12 +461,12 @@ func (p *Query) Policy() (localctx IPolicyContext) { if _la == QueryCBF { { - p.SetState(33) + p.SetState(36) p.CbfStmt() } } - p.SetState(39) + p.SetState(42) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -446,18 +475,18 @@ func (p *Query) Policy() (localctx IPolicyContext) { for _la == QuerySELECT { { - p.SetState(36) + p.SetState(39) p.SelectStmt() } - p.SetState(41) + p.SetState(44) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(45) + p.SetState(48) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -466,11 +495,11 @@ func (p *Query) Policy() (localctx IPolicyContext) { for _la == QueryFILTER { { - p.SetState(42) + p.SetState(45) p.FilterStmt() } - p.SetState(47) + p.SetState(50) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -478,7 +507,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(48) + p.SetState(51) p.Match(QueryEOF) if p.HasError() { // Recognition error - abort rule @@ -623,7 +652,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(50) + p.SetState(53) p.Match(QueryREP) if p.HasError() { // Recognition error - abort rule @@ -631,7 +660,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } } { - p.SetState(51) + p.SetState(54) var _m = p.Match(QueryNUMBER1) @@ -641,7 +670,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { goto errorExit } } - p.SetState(54) + p.SetState(57) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -650,7 +679,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { if _la == QueryIN { { - p.SetState(52) + p.SetState(55) p.Match(QueryIN) if p.HasError() { // Recognition error - abort rule @@ -658,7 +687,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } } { - p.SetState(53) + p.SetState(56) var _x = p.Ident() @@ -769,7 +798,7 @@ func (p *Query) CbfStmt() (localctx ICbfStmtContext) { p.EnterRule(localctx, 4, QueryRULE_cbfStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(56) + p.SetState(59) p.Match(QueryCBF) if p.HasError() { // Recognition error - abort rule @@ -777,7 +806,7 @@ func (p *Query) CbfStmt() (localctx ICbfStmtContext) { } } { - p.SetState(57) + p.SetState(60) var _m = p.Match(QueryNUMBER1) @@ -1017,7 +1046,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(59) + p.SetState(62) p.Match(QuerySELECT) if p.HasError() { // Recognition error - abort rule @@ -1025,7 +1054,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(60) + p.SetState(63) var _m = p.Match(QueryNUMBER1) @@ -1035,7 +1064,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { goto errorExit } } - p.SetState(66) + p.SetState(69) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1044,14 +1073,14 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryIN { { - p.SetState(61) + p.SetState(64) p.Match(QueryIN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(63) + p.SetState(66) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1060,13 +1089,13 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT { { - p.SetState(62) + p.SetState(65) p.Clause() } } { - p.SetState(65) + p.SetState(68) var _x = p.Ident() @@ -1075,7 +1104,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } { - p.SetState(68) + p.SetState(71) p.Match(QueryFROM) if p.HasError() { // Recognition error - abort rule @@ -1083,13 +1112,13 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(69) + p.SetState(72) var _x = p.IdentWC() localctx.(*SelectStmtContext).Filter = _x } - p.SetState(72) + p.SetState(75) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1098,7 +1127,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryAS { { - p.SetState(70) + p.SetState(73) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -1106,7 +1135,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(71) + p.SetState(74) var _x = p.Ident() @@ -1208,7 +1237,7 @@ func (p *Query) Clause() (localctx IClauseContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(74) + p.SetState(77) _la = p.GetTokenStream().LA(1) if !(_la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT) { @@ -1440,7 +1469,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(87) + p.SetState(90) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1449,7 +1478,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { switch p.GetTokenStream().LA(1) { case QueryNOT_OP: { - p.SetState(77) + p.SetState(80) var _m = p.Match(QueryNOT_OP) @@ -1460,7 +1489,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(78) + p.SetState(81) p.Match(QueryL_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1468,14 +1497,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(79) + p.SetState(82) var _x = p.filterExpr(0) localctx.(*FilterExprContext).F1 = _x } { - p.SetState(80) + p.SetState(83) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1485,7 +1514,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryL_PAREN: { - p.SetState(82) + p.SetState(85) p.Match(QueryL_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1493,14 +1522,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(83) + p.SetState(86) var _x = p.filterExpr(0) localctx.(*FilterExprContext).Inner = _x } { - p.SetState(84) + p.SetState(87) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1510,7 +1539,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING: { - p.SetState(86) + p.SetState(89) p.Expr() } @@ -1519,12 +1548,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(97) + p.SetState(100) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1534,25 +1563,25 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(95) + p.SetState(98) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 9, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) { case 1: localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(89) + p.SetState(92) if !(p.Precpred(p.GetParserRuleContext(), 4)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) goto errorExit } { - p.SetState(90) + p.SetState(93) var _m = p.Match(QueryAND_OP) @@ -1563,7 +1592,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(91) + p.SetState(94) var _x = p.filterExpr(5) @@ -1574,14 +1603,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(92) + p.SetState(95) if !(p.Precpred(p.GetParserRuleContext(), 3)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) goto errorExit } { - p.SetState(93) + p.SetState(96) var _m = p.Match(QueryOR_OP) @@ -1592,7 +1621,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(94) + p.SetState(97) var _x = p.filterExpr(4) @@ -1604,12 +1633,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } - p.SetState(99) + p.SetState(102) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1762,7 +1791,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { p.EnterRule(localctx, 12, QueryRULE_filterStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(100) + p.SetState(103) p.Match(QueryFILTER) if p.HasError() { // Recognition error - abort rule @@ -1770,14 +1799,14 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(101) + p.SetState(104) var _x = p.filterExpr(0) localctx.(*FilterStmtContext).Expr = _x } { - p.SetState(102) + p.SetState(105) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -1785,7 +1814,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(103) + p.SetState(106) var _x = p.Ident() @@ -1965,7 +1994,7 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Expr() (localctx IExprContext) { localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 14, QueryRULE_expr) - p.SetState(111) + p.SetState(114) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1975,7 +2004,7 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryAT: p.EnterOuterAlt(localctx, 1) { - p.SetState(105) + p.SetState(108) p.Match(QueryAT) if p.HasError() { // Recognition error - abort rule @@ -1983,7 +2012,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(106) + p.SetState(109) var _x = p.Ident() @@ -1993,14 +2022,14 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT, QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(107) + p.SetState(110) var _x = p.FilterKey() localctx.(*ExprContext).Key = _x } { - p.SetState(108) + p.SetState(111) p.Match(QuerySIMPLE_OP) if p.HasError() { // Recognition error - abort rule @@ -2008,7 +2037,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(109) + p.SetState(112) var _x = p.FilterValue() @@ -2121,7 +2150,7 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) FilterKey() (localctx IFilterKeyContext) { localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 16, QueryRULE_filterKey) - p.SetState(115) + p.SetState(118) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2131,14 +2160,14 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(113) + p.SetState(116) p.Ident() } case QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(114) + p.SetState(117) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2269,7 +2298,7 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *Query) FilterValue() (localctx IFilterValueContext) { localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 18, QueryRULE_filterValue) - p.SetState(120) + p.SetState(123) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2279,21 +2308,21 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(117) + p.SetState(120) p.Ident() } case QueryNUMBER1, QueryZERO: p.EnterOuterAlt(localctx, 2) { - p.SetState(118) + p.SetState(121) p.Number() } case QuerySTRING: p.EnterOuterAlt(localctx, 3) { - p.SetState(119) + p.SetState(122) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2399,7 +2428,7 @@ func (p *Query) Number() (localctx INumberContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(122) + p.SetState(125) _la = p.GetTokenStream().LA(1) if !(_la == QueryNUMBER1 || _la == QueryZERO) { @@ -2523,10 +2552,10 @@ func (p *Query) Keyword() (localctx IKeywordContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(124) + p.SetState(127) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3808) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&7616) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -2635,7 +2664,7 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Ident() (localctx IIdentContext) { localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 24, QueryRULE_ident) - p.SetState(128) + p.SetState(131) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2645,14 +2674,14 @@ func (p *Query) Ident() (localctx IIdentContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER: p.EnterOuterAlt(localctx, 1) { - p.SetState(126) + p.SetState(129) p.Keyword() } case QueryIDENT: p.EnterOuterAlt(localctx, 2) { - p.SetState(127) + p.SetState(130) p.Match(QueryIDENT) if p.HasError() { // Recognition error - abort rule @@ -2766,7 +2795,7 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) IdentWC() (localctx IIdentWCContext) { localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 26, QueryRULE_identWC) - p.SetState(132) + p.SetState(135) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2776,14 +2805,14 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(130) + p.SetState(133) p.Ident() } case QueryWILDCARD: p.EnterOuterAlt(localctx, 2) { - p.SetState(131) + p.SetState(134) p.Match(QueryWILDCARD) if p.HasError() { // Recognition error - abort rule diff --git a/netmap/parser/query_visitor.go b/netmap/parser/query_visitor.go index 8123c39..960dc2f 100644 --- a/netmap/parser/query_visitor.go +++ b/netmap/parser/query_visitor.go @@ -1,3 +1,5 @@ +// Code generated from Query.g4 by ANTLR 4.13.0. DO NOT EDIT. + package parser // Query import "github.com/antlr4-go/antlr/v4" diff --git a/netmap/policy.go b/netmap/policy.go index 3f6986e..a03d36e 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -28,6 +28,8 @@ type PlacementPolicy struct { selectors []netmap.Selector replicas []netmap.Replica + + unique bool } func (p *PlacementPolicy) readFromV2(m netmap.PlacementPolicy, checkFieldPresence bool) error { @@ -39,6 +41,7 @@ func (p *PlacementPolicy) readFromV2(m netmap.PlacementPolicy, checkFieldPresenc p.backupFactor = m.GetContainerBackupFactor() p.selectors = m.GetSelectors() p.filters = m.GetFilters() + p.unique = m.GetUnique() return nil } @@ -113,6 +116,7 @@ func (p PlacementPolicy) WriteToV2(m *netmap.PlacementPolicy) { m.SetFilters(p.filters) m.SetSelectors(p.selectors) m.SetReplicas(p.replicas) + m.SetUnique(p.unique) } // ReplicaDescriptor replica descriptor characterizes replicas of objects from @@ -178,6 +182,14 @@ func (p *PlacementPolicy) SetContainerBackupFactor(f uint32) { p.backupFactor = f } +// SetUnique sets the unique flag: it controls whether the selected replica buckets +// are disjoint or not. +// +// Zero PlacementPolicy has false unique flag. +func (p *PlacementPolicy) SetUnique(b bool) { + p.unique = b +} + // Selector describes the bucket selection operator: choose a number of nodes // from the bucket taking the nearest nodes to the related container by hash distance. type Selector struct { @@ -363,6 +375,12 @@ func (p *PlacementPolicy) AddFilters(fs ...Filter) { // // See also DecodeString. func (p PlacementPolicy) WriteStringTo(w io.StringWriter) (err error) { + if p.unique { + if _, err := w.WriteString("UNIQUE\n"); err != nil { + return err + } + } + delim := "" for i := range p.replicas { @@ -572,6 +590,9 @@ func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) any { } pl := new(PlacementPolicy) + + pl.unique = ctx.UNIQUE() != nil + repStmts := ctx.AllRepStmt() pl.replicas = make([]netmap.Replica, 0, len(repStmts)) diff --git a/netmap/policy_test.go b/netmap/policy_test.go index f0a7bc5..75167dc 100644 --- a/netmap/policy_test.go +++ b/netmap/policy_test.go @@ -27,6 +27,10 @@ FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`, `REP 7 IN SPB SELECT 1 IN City FROM SPBSSD AS SPB FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS SPBSSD`, + + `UNIQUE +REP 1 +REP 1`, } var p PlacementPolicy diff --git a/netmap/selector.go b/netmap/selector.go index 51ceb47..d8c767a 100644 --- a/netmap/selector.go +++ b/netmap/selector.go @@ -140,6 +140,9 @@ func (c *context) getSelectionBase(s netmap.Selector) []nodeAttrPair { attr := s.GetAttribute() for i := range c.netMap.nodes { + if c.usedNodes[c.netMap.nodes[i].hash] { + continue + } if isMain || c.match(f, c.netMap.nodes[i]) { if attr == "" { // Default attribute is transparent identifier which is different for every node. diff --git a/netmap/selector_test.go b/netmap/selector_test.go index a974852..a80d922 100644 --- a/netmap/selector_test.go +++ b/netmap/selector_test.go @@ -1,6 +1,7 @@ package netmap import ( + "encoding/binary" "fmt" "math/rand" "sort" @@ -244,6 +245,43 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { } } +func TestPlacementPolicy_Unique(t *testing.T) { + p := newPlacementPolicy(2, + []ReplicaDescriptor{ + newReplica(1, "S"), + newReplica(1, "S"), + }, + []Selector{ + newSelector("S", "City", 1, "*", (*Selector).SelectSame), + }, + []Filter{}) + p.unique = true + + var nodes []NodeInfo + for i, city := range []string{"Moscow", "Berlin", "Shenzhen"} { + for j := 0; j < 3; j++ { + node := nodeInfoFromAttributes("City", city) + node.SetPublicKey(binary.BigEndian.AppendUint16(nil, uint16(i*4+j))) + nodes = append(nodes, node) + } + } + + var nm NetMap + nm.SetNodes(nodes) + + v, err := nm.ContainerNodes(p, nil) + require.NoError(t, err) + for i, vi := range v { + for _, ni := range vi { + for j := 0; j < i; j++ { + for _, nj := range v[j] { + require.NotEqual(t, ni.hash, nj.hash) + } + } + } + } +} + func TestPlacementPolicy_ProcessSelectorsExceptForNodes(t *testing.T) { p := newPlacementPolicy(1, nil, []Selector{ From b2e302624dcc1f68577da0653892fbc06a387347 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 6 Jun 2023 09:27:28 +0300 Subject: [PATCH 022/323] [#73] pool/tree: Add proto tree service client Signed-off-by: Denis Kirillov --- Makefile | 4 + pool/tree/service/service.pb.go | 3454 ++++++++++++++++++++++++++ pool/tree/service/service_grpc.pb.go | 520 ++++ pool/tree/service/types.pb.go | 320 +++ syncTree.sh | 19 + 5 files changed, 4317 insertions(+) create mode 100644 pool/tree/service/service.pb.go create mode 100644 pool/tree/service/service_grpc.pb.go create mode 100644 pool/tree/service/types.pb.go create mode 100755 syncTree.sh diff --git a/Makefile b/Makefile index e149de9..e454dc2 100755 --- a/Makefile +++ b/Makefile @@ -44,6 +44,10 @@ docker/%: --env HOME=/work \ truecloudlab/frostfs-sdk-go make $* +# Synchronize tree service +sync-tree: + @./syncTree.sh + # Show this help prompt help: @echo ' Usage:' diff --git a/pool/tree/service/service.pb.go b/pool/tree/service/service.pb.go new file mode 100644 index 0000000..08664a6 --- /dev/null +++ b/pool/tree/service/service.pb.go @@ -0,0 +1,3454 @@ +//* +// Service for working with CRDT tree. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: pkg/services/tree/service.proto + +package tree + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AddRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *AddRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *AddRequest) Reset() { + *x = AddRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddRequest) ProtoMessage() {} + +func (x *AddRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddRequest.ProtoReflect.Descriptor instead. +func (*AddRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{0} +} + +func (x *AddRequest) GetBody() *AddRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type AddResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *AddResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *AddResponse) Reset() { + *x = AddResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddResponse) ProtoMessage() {} + +func (x *AddResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddResponse.ProtoReflect.Descriptor instead. +func (*AddResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{1} +} + +func (x *AddResponse) GetBody() *AddResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type AddByPathRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *AddByPathRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *AddByPathRequest) Reset() { + *x = AddByPathRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddByPathRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddByPathRequest) ProtoMessage() {} + +func (x *AddByPathRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddByPathRequest.ProtoReflect.Descriptor instead. +func (*AddByPathRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{2} +} + +func (x *AddByPathRequest) GetBody() *AddByPathRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddByPathRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type AddByPathResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *AddByPathResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *AddByPathResponse) Reset() { + *x = AddByPathResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddByPathResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddByPathResponse) ProtoMessage() {} + +func (x *AddByPathResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddByPathResponse.ProtoReflect.Descriptor instead. +func (*AddByPathResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{3} +} + +func (x *AddByPathResponse) GetBody() *AddByPathResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddByPathResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type RemoveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *RemoveRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *RemoveRequest) Reset() { + *x = RemoveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveRequest) ProtoMessage() {} + +func (x *RemoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveRequest.ProtoReflect.Descriptor instead. +func (*RemoveRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{4} +} + +func (x *RemoveRequest) GetBody() *RemoveRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *RemoveRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type RemoveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *RemoveResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *RemoveResponse) Reset() { + *x = RemoveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveResponse) ProtoMessage() {} + +func (x *RemoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveResponse.ProtoReflect.Descriptor instead. +func (*RemoveResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{5} +} + +func (x *RemoveResponse) GetBody() *RemoveResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *RemoveResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type MoveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *MoveRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *MoveRequest) Reset() { + *x = MoveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveRequest) ProtoMessage() {} + +func (x *MoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveRequest.ProtoReflect.Descriptor instead. +func (*MoveRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{6} +} + +func (x *MoveRequest) GetBody() *MoveRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *MoveRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type MoveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *MoveResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *MoveResponse) Reset() { + *x = MoveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveResponse) ProtoMessage() {} + +func (x *MoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveResponse.ProtoReflect.Descriptor instead. +func (*MoveResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{7} +} + +func (x *MoveResponse) GetBody() *MoveResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *MoveResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type GetNodeByPathRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *GetNodeByPathRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GetNodeByPathRequest) Reset() { + *x = GetNodeByPathRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeByPathRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeByPathRequest) ProtoMessage() {} + +func (x *GetNodeByPathRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeByPathRequest.ProtoReflect.Descriptor instead. +func (*GetNodeByPathRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{8} +} + +func (x *GetNodeByPathRequest) GetBody() *GetNodeByPathRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetNodeByPathRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type GetNodeByPathResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *GetNodeByPathResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GetNodeByPathResponse) Reset() { + *x = GetNodeByPathResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeByPathResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeByPathResponse) ProtoMessage() {} + +func (x *GetNodeByPathResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeByPathResponse.ProtoReflect.Descriptor instead. +func (*GetNodeByPathResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{9} +} + +func (x *GetNodeByPathResponse) GetBody() *GetNodeByPathResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetNodeByPathResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type GetSubTreeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *GetSubTreeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GetSubTreeRequest) Reset() { + *x = GetSubTreeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSubTreeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSubTreeRequest) ProtoMessage() {} + +func (x *GetSubTreeRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSubTreeRequest.ProtoReflect.Descriptor instead. +func (*GetSubTreeRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{10} +} + +func (x *GetSubTreeRequest) GetBody() *GetSubTreeRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetSubTreeRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type GetSubTreeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *GetSubTreeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GetSubTreeResponse) Reset() { + *x = GetSubTreeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSubTreeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSubTreeResponse) ProtoMessage() {} + +func (x *GetSubTreeResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSubTreeResponse.ProtoReflect.Descriptor instead. +func (*GetSubTreeResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{11} +} + +func (x *GetSubTreeResponse) GetBody() *GetSubTreeResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetSubTreeResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type TreeListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *TreeListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *TreeListRequest) Reset() { + *x = TreeListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TreeListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TreeListRequest) ProtoMessage() {} + +func (x *TreeListRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TreeListRequest.ProtoReflect.Descriptor instead. +func (*TreeListRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{12} +} + +func (x *TreeListRequest) GetBody() *TreeListRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *TreeListRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type TreeListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *TreeListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *TreeListResponse) Reset() { + *x = TreeListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TreeListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TreeListResponse) ProtoMessage() {} + +func (x *TreeListResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TreeListResponse.ProtoReflect.Descriptor instead. +func (*TreeListResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{13} +} + +func (x *TreeListResponse) GetBody() *TreeListResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *TreeListResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type ApplyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *ApplyRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *ApplyRequest) Reset() { + *x = ApplyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyRequest) ProtoMessage() {} + +func (x *ApplyRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyRequest.ProtoReflect.Descriptor instead. +func (*ApplyRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{14} +} + +func (x *ApplyRequest) GetBody() *ApplyRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ApplyRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type ApplyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *ApplyResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *ApplyResponse) Reset() { + *x = ApplyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyResponse) ProtoMessage() {} + +func (x *ApplyResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyResponse.ProtoReflect.Descriptor instead. +func (*ApplyResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{15} +} + +func (x *ApplyResponse) GetBody() *ApplyResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ApplyResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type GetOpLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *GetOpLogRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GetOpLogRequest) Reset() { + *x = GetOpLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOpLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOpLogRequest) ProtoMessage() {} + +func (x *GetOpLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOpLogRequest.ProtoReflect.Descriptor instead. +func (*GetOpLogRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{16} +} + +func (x *GetOpLogRequest) GetBody() *GetOpLogRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetOpLogRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type GetOpLogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *GetOpLogResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GetOpLogResponse) Reset() { + *x = GetOpLogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOpLogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOpLogResponse) ProtoMessage() {} + +func (x *GetOpLogResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOpLogResponse.ProtoReflect.Descriptor instead. +func (*GetOpLogResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{17} +} + +func (x *GetOpLogResponse) GetBody() *GetOpLogResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetOpLogResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type HealthcheckResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Response body. + Body *HealthcheckResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Response signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *HealthcheckResponse) Reset() { + *x = HealthcheckResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthcheckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthcheckResponse) ProtoMessage() {} + +func (x *HealthcheckResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthcheckResponse.ProtoReflect.Descriptor instead. +func (*HealthcheckResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{18} +} + +func (x *HealthcheckResponse) GetBody() *HealthcheckResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *HealthcheckResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type HealthcheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request body. + Body *HealthcheckRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Request signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *HealthcheckRequest) Reset() { + *x = HealthcheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthcheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthcheckRequest) ProtoMessage() {} + +func (x *HealthcheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthcheckRequest.ProtoReflect.Descriptor instead. +func (*HealthcheckRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{19} +} + +func (x *HealthcheckRequest) GetBody() *HealthcheckRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *HealthcheckRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +type AddRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // ID of the parent to attach node to. + ParentId uint64 `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + // Key-Value pairs with meta information. + Meta []*KeyValue `protobuf:"bytes,4,rep,name=meta,proto3" json:"meta,omitempty"` + // Bearer token in V2 format. + BearerToken []byte `protobuf:"bytes,5,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` +} + +func (x *AddRequest_Body) Reset() { + *x = AddRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddRequest_Body) ProtoMessage() {} + +func (x *AddRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddRequest_Body.ProtoReflect.Descriptor instead. +func (*AddRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *AddRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *AddRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *AddRequest_Body) GetParentId() uint64 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *AddRequest_Body) GetMeta() []*KeyValue { + if x != nil { + return x.Meta + } + return nil +} + +func (x *AddRequest_Body) GetBearerToken() []byte { + if x != nil { + return x.BearerToken + } + return nil +} + +type AddResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID of the created node. + NodeId uint64 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` +} + +func (x *AddResponse_Body) Reset() { + *x = AddResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddResponse_Body) ProtoMessage() {} + +func (x *AddResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddResponse_Body.ProtoReflect.Descriptor instead. +func (*AddResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *AddResponse_Body) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +type AddByPathRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // Attribute to build path with. Default: "FileName". + PathAttribute string `protobuf:"bytes,3,opt,name=path_attribute,json=pathAttribute,proto3" json:"path_attribute,omitempty"` + // List of path components. + Path []string `protobuf:"bytes,4,rep,name=path,proto3" json:"path,omitempty"` + // Node meta-information. + Meta []*KeyValue `protobuf:"bytes,5,rep,name=meta,proto3" json:"meta,omitempty"` + // Bearer token in V2 format. + BearerToken []byte `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` +} + +func (x *AddByPathRequest_Body) Reset() { + *x = AddByPathRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddByPathRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddByPathRequest_Body) ProtoMessage() {} + +func (x *AddByPathRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddByPathRequest_Body.ProtoReflect.Descriptor instead. +func (*AddByPathRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *AddByPathRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *AddByPathRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *AddByPathRequest_Body) GetPathAttribute() string { + if x != nil { + return x.PathAttribute + } + return "" +} + +func (x *AddByPathRequest_Body) GetPath() []string { + if x != nil { + return x.Path + } + return nil +} + +func (x *AddByPathRequest_Body) GetMeta() []*KeyValue { + if x != nil { + return x.Meta + } + return nil +} + +func (x *AddByPathRequest_Body) GetBearerToken() []byte { + if x != nil { + return x.BearerToken + } + return nil +} + +type AddByPathResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of all created nodes. The first one is the leaf. + Nodes []uint64 `protobuf:"varint,1,rep,packed,name=nodes,proto3" json:"nodes,omitempty"` + // ID of the parent node where new nodes were attached. + ParentId uint64 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` +} + +func (x *AddByPathResponse_Body) Reset() { + *x = AddByPathResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddByPathResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddByPathResponse_Body) ProtoMessage() {} + +func (x *AddByPathResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddByPathResponse_Body.ProtoReflect.Descriptor instead. +func (*AddByPathResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *AddByPathResponse_Body) GetNodes() []uint64 { + if x != nil { + return x.Nodes + } + return nil +} + +func (x *AddByPathResponse_Body) GetParentId() uint64 { + if x != nil { + return x.ParentId + } + return 0 +} + +type RemoveRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // ID of the node to remove. + NodeId uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // Bearer token in V2 format. + BearerToken []byte `protobuf:"bytes,4,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` +} + +func (x *RemoveRequest_Body) Reset() { + *x = RemoveRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveRequest_Body) ProtoMessage() {} + +func (x *RemoveRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveRequest_Body.ProtoReflect.Descriptor instead. +func (*RemoveRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *RemoveRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *RemoveRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *RemoveRequest_Body) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *RemoveRequest_Body) GetBearerToken() []byte { + if x != nil { + return x.BearerToken + } + return nil +} + +type RemoveResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveResponse_Body) Reset() { + *x = RemoveResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveResponse_Body) ProtoMessage() {} + +func (x *RemoveResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveResponse_Body.ProtoReflect.Descriptor instead. +func (*RemoveResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{5, 0} +} + +type MoveRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // TODO import neo.fs.v2.refs.ContainerID directly. + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // ID of the new parent. + ParentId uint64 `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + // ID of the node to move. + NodeId uint64 `protobuf:"varint,4,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // Node meta-information. + Meta []*KeyValue `protobuf:"bytes,5,rep,name=meta,proto3" json:"meta,omitempty"` + // Bearer token in V2 format. + BearerToken []byte `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` +} + +func (x *MoveRequest_Body) Reset() { + *x = MoveRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveRequest_Body) ProtoMessage() {} + +func (x *MoveRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveRequest_Body.ProtoReflect.Descriptor instead. +func (*MoveRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *MoveRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *MoveRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *MoveRequest_Body) GetParentId() uint64 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *MoveRequest_Body) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *MoveRequest_Body) GetMeta() []*KeyValue { + if x != nil { + return x.Meta + } + return nil +} + +func (x *MoveRequest_Body) GetBearerToken() []byte { + if x != nil { + return x.BearerToken + } + return nil +} + +type MoveResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MoveResponse_Body) Reset() { + *x = MoveResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveResponse_Body) ProtoMessage() {} + +func (x *MoveResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveResponse_Body.ProtoReflect.Descriptor instead. +func (*MoveResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{7, 0} +} + +type GetNodeByPathRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // Attribute to build path with. Default: "FileName". + PathAttribute string `protobuf:"bytes,3,opt,name=path_attribute,json=pathAttribute,proto3" json:"path_attribute,omitempty"` + // List of path components. + Path []string `protobuf:"bytes,4,rep,name=path,proto3" json:"path,omitempty"` + // List of attributes to include in response. + Attributes []string `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` + // Flag to return only the latest version of node. + LatestOnly bool `protobuf:"varint,6,opt,name=latest_only,json=latestOnly,proto3" json:"latest_only,omitempty"` + // Flag to return all stored attributes. + AllAttributes bool `protobuf:"varint,7,opt,name=all_attributes,json=allAttributes,proto3" json:"all_attributes,omitempty"` + // Bearer token in V2 format. + BearerToken []byte `protobuf:"bytes,8,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` +} + +func (x *GetNodeByPathRequest_Body) Reset() { + *x = GetNodeByPathRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeByPathRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeByPathRequest_Body) ProtoMessage() {} + +func (x *GetNodeByPathRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeByPathRequest_Body.ProtoReflect.Descriptor instead. +func (*GetNodeByPathRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *GetNodeByPathRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *GetNodeByPathRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *GetNodeByPathRequest_Body) GetPathAttribute() string { + if x != nil { + return x.PathAttribute + } + return "" +} + +func (x *GetNodeByPathRequest_Body) GetPath() []string { + if x != nil { + return x.Path + } + return nil +} + +func (x *GetNodeByPathRequest_Body) GetAttributes() []string { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *GetNodeByPathRequest_Body) GetLatestOnly() bool { + if x != nil { + return x.LatestOnly + } + return false +} + +func (x *GetNodeByPathRequest_Body) GetAllAttributes() bool { + if x != nil { + return x.AllAttributes + } + return false +} + +func (x *GetNodeByPathRequest_Body) GetBearerToken() []byte { + if x != nil { + return x.BearerToken + } + return nil +} + +// Information about a single tree node. +type GetNodeByPathResponse_Info struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Node ID. + NodeId uint64 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // Timestamp of the last operation with the node. + Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Node meta-information. + Meta []*KeyValue `protobuf:"bytes,3,rep,name=meta,proto3" json:"meta,omitempty"` + // Parent ID. + ParentId uint64 `protobuf:"varint,4,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` +} + +func (x *GetNodeByPathResponse_Info) Reset() { + *x = GetNodeByPathResponse_Info{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeByPathResponse_Info) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeByPathResponse_Info) ProtoMessage() {} + +func (x *GetNodeByPathResponse_Info) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeByPathResponse_Info.ProtoReflect.Descriptor instead. +func (*GetNodeByPathResponse_Info) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{9, 0} +} + +func (x *GetNodeByPathResponse_Info) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GetNodeByPathResponse_Info) GetTimestamp() uint64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetNodeByPathResponse_Info) GetMeta() []*KeyValue { + if x != nil { + return x.Meta + } + return nil +} + +func (x *GetNodeByPathResponse_Info) GetParentId() uint64 { + if x != nil { + return x.ParentId + } + return 0 +} + +type GetNodeByPathResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of nodes stored by path. + Nodes []*GetNodeByPathResponse_Info `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` +} + +func (x *GetNodeByPathResponse_Body) Reset() { + *x = GetNodeByPathResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNodeByPathResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNodeByPathResponse_Body) ProtoMessage() {} + +func (x *GetNodeByPathResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNodeByPathResponse_Body.ProtoReflect.Descriptor instead. +func (*GetNodeByPathResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{9, 1} +} + +func (x *GetNodeByPathResponse_Body) GetNodes() []*GetNodeByPathResponse_Info { + if x != nil { + return x.Nodes + } + return nil +} + +type GetSubTreeRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // ID of the root node of a subtree. + RootId uint64 `protobuf:"varint,3,opt,name=root_id,json=rootId,proto3" json:"root_id,omitempty"` + // Optional depth of the traversal. Zero means return only root. + // Maximum depth is 10. + Depth uint32 `protobuf:"varint,4,opt,name=depth,proto3" json:"depth,omitempty"` + // Bearer token in V2 format. + BearerToken []byte `protobuf:"bytes,5,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` +} + +func (x *GetSubTreeRequest_Body) Reset() { + *x = GetSubTreeRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSubTreeRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSubTreeRequest_Body) ProtoMessage() {} + +func (x *GetSubTreeRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSubTreeRequest_Body.ProtoReflect.Descriptor instead. +func (*GetSubTreeRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{10, 0} +} + +func (x *GetSubTreeRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *GetSubTreeRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *GetSubTreeRequest_Body) GetRootId() uint64 { + if x != nil { + return x.RootId + } + return 0 +} + +func (x *GetSubTreeRequest_Body) GetDepth() uint32 { + if x != nil { + return x.Depth + } + return 0 +} + +func (x *GetSubTreeRequest_Body) GetBearerToken() []byte { + if x != nil { + return x.BearerToken + } + return nil +} + +type GetSubTreeResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID of the node. + NodeId uint64 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // ID of the parent. + ParentId uint64 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + // Time node was first added to a tree. + Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Node meta-information. + Meta []*KeyValue `protobuf:"bytes,4,rep,name=meta,proto3" json:"meta,omitempty"` +} + +func (x *GetSubTreeResponse_Body) Reset() { + *x = GetSubTreeResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSubTreeResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSubTreeResponse_Body) ProtoMessage() {} + +func (x *GetSubTreeResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSubTreeResponse_Body.ProtoReflect.Descriptor instead. +func (*GetSubTreeResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{11, 0} +} + +func (x *GetSubTreeResponse_Body) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *GetSubTreeResponse_Body) GetParentId() uint64 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *GetSubTreeResponse_Body) GetTimestamp() uint64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetSubTreeResponse_Body) GetMeta() []*KeyValue { + if x != nil { + return x.Meta + } + return nil +} + +type TreeListRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` +} + +func (x *TreeListRequest_Body) Reset() { + *x = TreeListRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TreeListRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TreeListRequest_Body) ProtoMessage() {} + +func (x *TreeListRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TreeListRequest_Body.ProtoReflect.Descriptor instead. +func (*TreeListRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *TreeListRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +type TreeListResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Tree IDs. + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (x *TreeListResponse_Body) Reset() { + *x = TreeListResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TreeListResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TreeListResponse_Body) ProtoMessage() {} + +func (x *TreeListResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TreeListResponse_Body.ProtoReflect.Descriptor instead. +func (*TreeListResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{13, 0} +} + +func (x *TreeListResponse_Body) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type ApplyRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // Operation to be applied. + Operation *LogMove `protobuf:"bytes,3,opt,name=operation,proto3" json:"operation,omitempty"` +} + +func (x *ApplyRequest_Body) Reset() { + *x = ApplyRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyRequest_Body) ProtoMessage() {} + +func (x *ApplyRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyRequest_Body.ProtoReflect.Descriptor instead. +func (*ApplyRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{14, 0} +} + +func (x *ApplyRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *ApplyRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *ApplyRequest_Body) GetOperation() *LogMove { + if x != nil { + return x.Operation + } + return nil +} + +type ApplyResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ApplyResponse_Body) Reset() { + *x = ApplyResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplyResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyResponse_Body) ProtoMessage() {} + +func (x *ApplyResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApplyResponse_Body.ProtoReflect.Descriptor instead. +func (*ApplyResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{15, 0} +} + +type GetOpLogRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container ID in V2 format. + ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // The name of the tree. + TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` + // Starting height to return logs from. + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + // Amount of operations to return. + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *GetOpLogRequest_Body) Reset() { + *x = GetOpLogRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOpLogRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOpLogRequest_Body) ProtoMessage() {} + +func (x *GetOpLogRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOpLogRequest_Body.ProtoReflect.Descriptor instead. +func (*GetOpLogRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{16, 0} +} + +func (x *GetOpLogRequest_Body) GetContainerId() []byte { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *GetOpLogRequest_Body) GetTreeId() string { + if x != nil { + return x.TreeId + } + return "" +} + +func (x *GetOpLogRequest_Body) GetHeight() uint64 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *GetOpLogRequest_Body) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type GetOpLogResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Operation on a tree. + Operation *LogMove `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` +} + +func (x *GetOpLogResponse_Body) Reset() { + *x = GetOpLogResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOpLogResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOpLogResponse_Body) ProtoMessage() {} + +func (x *GetOpLogResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOpLogResponse_Body.ProtoReflect.Descriptor instead. +func (*GetOpLogResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{17, 0} +} + +func (x *GetOpLogResponse_Body) GetOperation() *LogMove { + if x != nil { + return x.Operation + } + return nil +} + +type HealthcheckResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HealthcheckResponse_Body) Reset() { + *x = HealthcheckResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthcheckResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthcheckResponse_Body) ProtoMessage() {} + +func (x *HealthcheckResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthcheckResponse_Body.ProtoReflect.Descriptor instead. +func (*HealthcheckResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{18, 0} +} + +type HealthcheckRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HealthcheckRequest_Body) Reset() { + *x = HealthcheckRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthcheckRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthcheckRequest_Body) ProtoMessage() {} + +func (x *HealthcheckRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthcheckRequest_Body.ProtoReflect.Descriptor instead. +func (*HealthcheckRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{19, 0} +} + +var File_pkg_services_tree_service_proto protoreflect.FileDescriptor + +var file_pkg_services_tree_service_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74, + 0x72, 0x65, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x04, 0x74, 0x72, 0x65, 0x65, 0x1a, 0x1d, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x02, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, + 0xa6, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, + 0x65, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, + 0x64, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x0b, 0x41, 0x64, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x1f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6e, + 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x6f, + 0x64, 0x65, 0x49, 0x64, 0x22, 0xb9, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, + 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, + 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0xc4, 0x01, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x25, + 0x0a, 0x0e, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x68, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, + 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x21, 0x0a, + 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0xaf, 0x01, 0x0a, 0x11, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, + 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x05, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x49, 0x64, 0x22, 0xec, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x1a, 0x7e, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, + 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x21, + 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x76, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xaa, 0x02, 0x0a, 0x0b, 0x4d, 0x6f, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, + 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x1a, 0xbf, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, + 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, + 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x6d, + 0x65, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, + 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x72, 0x0a, 0x0c, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, 0x76, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x85, 0x03, 0x0a, 0x14, 0x47, + 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, + 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x88, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x68, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x61, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x5f, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x21, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0xbc, 0x02, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x1a, 0x7e, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, + 0x6d, 0x65, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, + 0x64, 0x1a, 0x3e, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, 0x0a, 0x05, 0x6e, 0x6f, 0x64, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, + 0x73, 0x22, 0x8b, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x94, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, + 0x72, 0x6f, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0x21, 0x0a, 0x0c, + 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0xf6, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x7e, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x9b, 0x01, 0x0a, 0x0f, 0x54, 0x72, 0x65, + 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x29, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x18, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xdb, 0x01, 0x0a, 0x0c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x1a, 0x6f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe2, 0x01, 0x0a, 0x0f, 0x47, 0x65, + 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x70, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa7, + 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x33, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2b, 0x0a, 0x09, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x32, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x7e, 0x0a, 0x12, 0x48, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0xd6, 0x04, 0x0a, 0x0b, + 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x41, + 0x64, 0x64, 0x12, 0x10, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x42, 0x79, + 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, + 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, + 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x4d, 0x6f, + 0x76, 0x65, 0x12, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, 0x76, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1a, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, + 0x65, 0x12, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, + 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x39, 0x0a, 0x08, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x30, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x12, + 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, + 0x12, 0x42, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, + 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x6e, 0x6f, + 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, + 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_services_tree_service_proto_rawDescOnce sync.Once + file_pkg_services_tree_service_proto_rawDescData = file_pkg_services_tree_service_proto_rawDesc +) + +func file_pkg_services_tree_service_proto_rawDescGZIP() []byte { + file_pkg_services_tree_service_proto_rawDescOnce.Do(func() { + file_pkg_services_tree_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_services_tree_service_proto_rawDescData) + }) + return file_pkg_services_tree_service_proto_rawDescData +} + +var file_pkg_services_tree_service_proto_msgTypes = make([]protoimpl.MessageInfo, 41) +var file_pkg_services_tree_service_proto_goTypes = []interface{}{ + (*AddRequest)(nil), // 0: tree.AddRequest + (*AddResponse)(nil), // 1: tree.AddResponse + (*AddByPathRequest)(nil), // 2: tree.AddByPathRequest + (*AddByPathResponse)(nil), // 3: tree.AddByPathResponse + (*RemoveRequest)(nil), // 4: tree.RemoveRequest + (*RemoveResponse)(nil), // 5: tree.RemoveResponse + (*MoveRequest)(nil), // 6: tree.MoveRequest + (*MoveResponse)(nil), // 7: tree.MoveResponse + (*GetNodeByPathRequest)(nil), // 8: tree.GetNodeByPathRequest + (*GetNodeByPathResponse)(nil), // 9: tree.GetNodeByPathResponse + (*GetSubTreeRequest)(nil), // 10: tree.GetSubTreeRequest + (*GetSubTreeResponse)(nil), // 11: tree.GetSubTreeResponse + (*TreeListRequest)(nil), // 12: tree.TreeListRequest + (*TreeListResponse)(nil), // 13: tree.TreeListResponse + (*ApplyRequest)(nil), // 14: tree.ApplyRequest + (*ApplyResponse)(nil), // 15: tree.ApplyResponse + (*GetOpLogRequest)(nil), // 16: tree.GetOpLogRequest + (*GetOpLogResponse)(nil), // 17: tree.GetOpLogResponse + (*HealthcheckResponse)(nil), // 18: tree.HealthcheckResponse + (*HealthcheckRequest)(nil), // 19: tree.HealthcheckRequest + (*AddRequest_Body)(nil), // 20: tree.AddRequest.Body + (*AddResponse_Body)(nil), // 21: tree.AddResponse.Body + (*AddByPathRequest_Body)(nil), // 22: tree.AddByPathRequest.Body + (*AddByPathResponse_Body)(nil), // 23: tree.AddByPathResponse.Body + (*RemoveRequest_Body)(nil), // 24: tree.RemoveRequest.Body + (*RemoveResponse_Body)(nil), // 25: tree.RemoveResponse.Body + (*MoveRequest_Body)(nil), // 26: tree.MoveRequest.Body + (*MoveResponse_Body)(nil), // 27: tree.MoveResponse.Body + (*GetNodeByPathRequest_Body)(nil), // 28: tree.GetNodeByPathRequest.Body + (*GetNodeByPathResponse_Info)(nil), // 29: tree.GetNodeByPathResponse.Info + (*GetNodeByPathResponse_Body)(nil), // 30: tree.GetNodeByPathResponse.Body + (*GetSubTreeRequest_Body)(nil), // 31: tree.GetSubTreeRequest.Body + (*GetSubTreeResponse_Body)(nil), // 32: tree.GetSubTreeResponse.Body + (*TreeListRequest_Body)(nil), // 33: tree.TreeListRequest.Body + (*TreeListResponse_Body)(nil), // 34: tree.TreeListResponse.Body + (*ApplyRequest_Body)(nil), // 35: tree.ApplyRequest.Body + (*ApplyResponse_Body)(nil), // 36: tree.ApplyResponse.Body + (*GetOpLogRequest_Body)(nil), // 37: tree.GetOpLogRequest.Body + (*GetOpLogResponse_Body)(nil), // 38: tree.GetOpLogResponse.Body + (*HealthcheckResponse_Body)(nil), // 39: tree.HealthcheckResponse.Body + (*HealthcheckRequest_Body)(nil), // 40: tree.HealthcheckRequest.Body + (*Signature)(nil), // 41: tree.Signature + (*KeyValue)(nil), // 42: tree.KeyValue + (*LogMove)(nil), // 43: tree.LogMove +} +var file_pkg_services_tree_service_proto_depIdxs = []int32{ + 20, // 0: tree.AddRequest.body:type_name -> tree.AddRequest.Body + 41, // 1: tree.AddRequest.signature:type_name -> tree.Signature + 21, // 2: tree.AddResponse.body:type_name -> tree.AddResponse.Body + 41, // 3: tree.AddResponse.signature:type_name -> tree.Signature + 22, // 4: tree.AddByPathRequest.body:type_name -> tree.AddByPathRequest.Body + 41, // 5: tree.AddByPathRequest.signature:type_name -> tree.Signature + 23, // 6: tree.AddByPathResponse.body:type_name -> tree.AddByPathResponse.Body + 41, // 7: tree.AddByPathResponse.signature:type_name -> tree.Signature + 24, // 8: tree.RemoveRequest.body:type_name -> tree.RemoveRequest.Body + 41, // 9: tree.RemoveRequest.signature:type_name -> tree.Signature + 25, // 10: tree.RemoveResponse.body:type_name -> tree.RemoveResponse.Body + 41, // 11: tree.RemoveResponse.signature:type_name -> tree.Signature + 26, // 12: tree.MoveRequest.body:type_name -> tree.MoveRequest.Body + 41, // 13: tree.MoveRequest.signature:type_name -> tree.Signature + 27, // 14: tree.MoveResponse.body:type_name -> tree.MoveResponse.Body + 41, // 15: tree.MoveResponse.signature:type_name -> tree.Signature + 28, // 16: tree.GetNodeByPathRequest.body:type_name -> tree.GetNodeByPathRequest.Body + 41, // 17: tree.GetNodeByPathRequest.signature:type_name -> tree.Signature + 30, // 18: tree.GetNodeByPathResponse.body:type_name -> tree.GetNodeByPathResponse.Body + 41, // 19: tree.GetNodeByPathResponse.signature:type_name -> tree.Signature + 31, // 20: tree.GetSubTreeRequest.body:type_name -> tree.GetSubTreeRequest.Body + 41, // 21: tree.GetSubTreeRequest.signature:type_name -> tree.Signature + 32, // 22: tree.GetSubTreeResponse.body:type_name -> tree.GetSubTreeResponse.Body + 41, // 23: tree.GetSubTreeResponse.signature:type_name -> tree.Signature + 33, // 24: tree.TreeListRequest.body:type_name -> tree.TreeListRequest.Body + 41, // 25: tree.TreeListRequest.signature:type_name -> tree.Signature + 34, // 26: tree.TreeListResponse.body:type_name -> tree.TreeListResponse.Body + 41, // 27: tree.TreeListResponse.signature:type_name -> tree.Signature + 35, // 28: tree.ApplyRequest.body:type_name -> tree.ApplyRequest.Body + 41, // 29: tree.ApplyRequest.signature:type_name -> tree.Signature + 36, // 30: tree.ApplyResponse.body:type_name -> tree.ApplyResponse.Body + 41, // 31: tree.ApplyResponse.signature:type_name -> tree.Signature + 37, // 32: tree.GetOpLogRequest.body:type_name -> tree.GetOpLogRequest.Body + 41, // 33: tree.GetOpLogRequest.signature:type_name -> tree.Signature + 38, // 34: tree.GetOpLogResponse.body:type_name -> tree.GetOpLogResponse.Body + 41, // 35: tree.GetOpLogResponse.signature:type_name -> tree.Signature + 39, // 36: tree.HealthcheckResponse.body:type_name -> tree.HealthcheckResponse.Body + 41, // 37: tree.HealthcheckResponse.signature:type_name -> tree.Signature + 40, // 38: tree.HealthcheckRequest.body:type_name -> tree.HealthcheckRequest.Body + 41, // 39: tree.HealthcheckRequest.signature:type_name -> tree.Signature + 42, // 40: tree.AddRequest.Body.meta:type_name -> tree.KeyValue + 42, // 41: tree.AddByPathRequest.Body.meta:type_name -> tree.KeyValue + 42, // 42: tree.MoveRequest.Body.meta:type_name -> tree.KeyValue + 42, // 43: tree.GetNodeByPathResponse.Info.meta:type_name -> tree.KeyValue + 29, // 44: tree.GetNodeByPathResponse.Body.nodes:type_name -> tree.GetNodeByPathResponse.Info + 42, // 45: tree.GetSubTreeResponse.Body.meta:type_name -> tree.KeyValue + 43, // 46: tree.ApplyRequest.Body.operation:type_name -> tree.LogMove + 43, // 47: tree.GetOpLogResponse.Body.operation:type_name -> tree.LogMove + 0, // 48: tree.TreeService.Add:input_type -> tree.AddRequest + 2, // 49: tree.TreeService.AddByPath:input_type -> tree.AddByPathRequest + 4, // 50: tree.TreeService.Remove:input_type -> tree.RemoveRequest + 6, // 51: tree.TreeService.Move:input_type -> tree.MoveRequest + 8, // 52: tree.TreeService.GetNodeByPath:input_type -> tree.GetNodeByPathRequest + 10, // 53: tree.TreeService.GetSubTree:input_type -> tree.GetSubTreeRequest + 12, // 54: tree.TreeService.TreeList:input_type -> tree.TreeListRequest + 14, // 55: tree.TreeService.Apply:input_type -> tree.ApplyRequest + 16, // 56: tree.TreeService.GetOpLog:input_type -> tree.GetOpLogRequest + 19, // 57: tree.TreeService.Healthcheck:input_type -> tree.HealthcheckRequest + 1, // 58: tree.TreeService.Add:output_type -> tree.AddResponse + 3, // 59: tree.TreeService.AddByPath:output_type -> tree.AddByPathResponse + 5, // 60: tree.TreeService.Remove:output_type -> tree.RemoveResponse + 7, // 61: tree.TreeService.Move:output_type -> tree.MoveResponse + 9, // 62: tree.TreeService.GetNodeByPath:output_type -> tree.GetNodeByPathResponse + 11, // 63: tree.TreeService.GetSubTree:output_type -> tree.GetSubTreeResponse + 13, // 64: tree.TreeService.TreeList:output_type -> tree.TreeListResponse + 15, // 65: tree.TreeService.Apply:output_type -> tree.ApplyResponse + 17, // 66: tree.TreeService.GetOpLog:output_type -> tree.GetOpLogResponse + 18, // 67: tree.TreeService.Healthcheck:output_type -> tree.HealthcheckResponse + 58, // [58:68] is the sub-list for method output_type + 48, // [48:58] is the sub-list for method input_type + 48, // [48:48] is the sub-list for extension type_name + 48, // [48:48] is the sub-list for extension extendee + 0, // [0:48] is the sub-list for field type_name +} + +func init() { file_pkg_services_tree_service_proto_init() } +func file_pkg_services_tree_service_proto_init() { + if File_pkg_services_tree_service_proto != nil { + return + } + file_pkg_services_tree_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_pkg_services_tree_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddByPathRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddByPathResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeByPathRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeByPathResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSubTreeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSubTreeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TreeListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TreeListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOpLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOpLogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthcheckResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthcheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddByPathRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddByPathResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeByPathRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeByPathResponse_Info); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNodeByPathResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSubTreeRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSubTreeResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TreeListRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TreeListResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplyResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOpLogRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOpLogResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthcheckResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthcheckRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_services_tree_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 41, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkg_services_tree_service_proto_goTypes, + DependencyIndexes: file_pkg_services_tree_service_proto_depIdxs, + MessageInfos: file_pkg_services_tree_service_proto_msgTypes, + }.Build() + File_pkg_services_tree_service_proto = out.File + file_pkg_services_tree_service_proto_rawDesc = nil + file_pkg_services_tree_service_proto_goTypes = nil + file_pkg_services_tree_service_proto_depIdxs = nil +} diff --git a/pool/tree/service/service_grpc.pb.go b/pool/tree/service/service_grpc.pb.go new file mode 100644 index 0000000..f981746 --- /dev/null +++ b/pool/tree/service/service_grpc.pb.go @@ -0,0 +1,520 @@ +//* +// Service for working with CRDT tree. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.12.4 +// source: pkg/services/tree/service.proto + +package tree + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + TreeService_Add_FullMethodName = "/tree.TreeService/Add" + TreeService_AddByPath_FullMethodName = "/tree.TreeService/AddByPath" + TreeService_Remove_FullMethodName = "/tree.TreeService/Remove" + TreeService_Move_FullMethodName = "/tree.TreeService/Move" + TreeService_GetNodeByPath_FullMethodName = "/tree.TreeService/GetNodeByPath" + TreeService_GetSubTree_FullMethodName = "/tree.TreeService/GetSubTree" + TreeService_TreeList_FullMethodName = "/tree.TreeService/TreeList" + TreeService_Apply_FullMethodName = "/tree.TreeService/Apply" + TreeService_GetOpLog_FullMethodName = "/tree.TreeService/GetOpLog" + TreeService_Healthcheck_FullMethodName = "/tree.TreeService/Healthcheck" +) + +// TreeServiceClient is the client API for TreeService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TreeServiceClient interface { + // Add adds new node to the tree. Invoked by a client. + Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) + // AddByPath adds new node to the tree by path. Invoked by a client. + AddByPath(ctx context.Context, in *AddByPathRequest, opts ...grpc.CallOption) (*AddByPathResponse, error) + // Remove removes node from the tree. Invoked by a client. + Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) + // Move moves node from one parent to another. Invoked by a client. + Move(ctx context.Context, in *MoveRequest, opts ...grpc.CallOption) (*MoveResponse, error) + // GetNodeByPath returns list of IDs corresponding to a specific filepath. + GetNodeByPath(ctx context.Context, in *GetNodeByPathRequest, opts ...grpc.CallOption) (*GetNodeByPathResponse, error) + // GetSubTree returns tree corresponding to a specific node. + GetSubTree(ctx context.Context, in *GetSubTreeRequest, opts ...grpc.CallOption) (TreeService_GetSubTreeClient, error) + // TreeList return list of the existing trees in the container. + TreeList(ctx context.Context, in *TreeListRequest, opts ...grpc.CallOption) (*TreeListResponse, error) + // Apply pushes log operation from another node to the current. + // The request must be signed by a container node. + Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) + // GetOpLog returns a stream of logged operations starting from some height. + GetOpLog(ctx context.Context, in *GetOpLogRequest, opts ...grpc.CallOption) (TreeService_GetOpLogClient, error) + // Healthcheck is a dummy rpc to check service availability + Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error) +} + +type treeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTreeServiceClient(cc grpc.ClientConnInterface) TreeServiceClient { + return &treeServiceClient{cc} +} + +func (c *treeServiceClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) { + out := new(AddResponse) + err := c.cc.Invoke(ctx, TreeService_Add_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) AddByPath(ctx context.Context, in *AddByPathRequest, opts ...grpc.CallOption) (*AddByPathResponse, error) { + out := new(AddByPathResponse) + err := c.cc.Invoke(ctx, TreeService_AddByPath_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) { + out := new(RemoveResponse) + err := c.cc.Invoke(ctx, TreeService_Remove_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) Move(ctx context.Context, in *MoveRequest, opts ...grpc.CallOption) (*MoveResponse, error) { + out := new(MoveResponse) + err := c.cc.Invoke(ctx, TreeService_Move_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) GetNodeByPath(ctx context.Context, in *GetNodeByPathRequest, opts ...grpc.CallOption) (*GetNodeByPathResponse, error) { + out := new(GetNodeByPathResponse) + err := c.cc.Invoke(ctx, TreeService_GetNodeByPath_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) GetSubTree(ctx context.Context, in *GetSubTreeRequest, opts ...grpc.CallOption) (TreeService_GetSubTreeClient, error) { + stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[0], TreeService_GetSubTree_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &treeServiceGetSubTreeClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type TreeService_GetSubTreeClient interface { + Recv() (*GetSubTreeResponse, error) + grpc.ClientStream +} + +type treeServiceGetSubTreeClient struct { + grpc.ClientStream +} + +func (x *treeServiceGetSubTreeClient) Recv() (*GetSubTreeResponse, error) { + m := new(GetSubTreeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *treeServiceClient) TreeList(ctx context.Context, in *TreeListRequest, opts ...grpc.CallOption) (*TreeListResponse, error) { + out := new(TreeListResponse) + err := c.cc.Invoke(ctx, TreeService_TreeList_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) { + out := new(ApplyResponse) + err := c.cc.Invoke(ctx, TreeService_Apply_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *treeServiceClient) GetOpLog(ctx context.Context, in *GetOpLogRequest, opts ...grpc.CallOption) (TreeService_GetOpLogClient, error) { + stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[1], TreeService_GetOpLog_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &treeServiceGetOpLogClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type TreeService_GetOpLogClient interface { + Recv() (*GetOpLogResponse, error) + grpc.ClientStream +} + +type treeServiceGetOpLogClient struct { + grpc.ClientStream +} + +func (x *treeServiceGetOpLogClient) Recv() (*GetOpLogResponse, error) { + m := new(GetOpLogResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *treeServiceClient) Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error) { + out := new(HealthcheckResponse) + err := c.cc.Invoke(ctx, TreeService_Healthcheck_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TreeServiceServer is the server API for TreeService service. +// All implementations should embed UnimplementedTreeServiceServer +// for forward compatibility +type TreeServiceServer interface { + // Add adds new node to the tree. Invoked by a client. + Add(context.Context, *AddRequest) (*AddResponse, error) + // AddByPath adds new node to the tree by path. Invoked by a client. + AddByPath(context.Context, *AddByPathRequest) (*AddByPathResponse, error) + // Remove removes node from the tree. Invoked by a client. + Remove(context.Context, *RemoveRequest) (*RemoveResponse, error) + // Move moves node from one parent to another. Invoked by a client. + Move(context.Context, *MoveRequest) (*MoveResponse, error) + // GetNodeByPath returns list of IDs corresponding to a specific filepath. + GetNodeByPath(context.Context, *GetNodeByPathRequest) (*GetNodeByPathResponse, error) + // GetSubTree returns tree corresponding to a specific node. + GetSubTree(*GetSubTreeRequest, TreeService_GetSubTreeServer) error + // TreeList return list of the existing trees in the container. + TreeList(context.Context, *TreeListRequest) (*TreeListResponse, error) + // Apply pushes log operation from another node to the current. + // The request must be signed by a container node. + Apply(context.Context, *ApplyRequest) (*ApplyResponse, error) + // GetOpLog returns a stream of logged operations starting from some height. + GetOpLog(*GetOpLogRequest, TreeService_GetOpLogServer) error + // Healthcheck is a dummy rpc to check service availability + Healthcheck(context.Context, *HealthcheckRequest) (*HealthcheckResponse, error) +} + +// UnimplementedTreeServiceServer should be embedded to have forward compatible implementations. +type UnimplementedTreeServiceServer struct { +} + +func (UnimplementedTreeServiceServer) Add(context.Context, *AddRequest) (*AddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") +} +func (UnimplementedTreeServiceServer) AddByPath(context.Context, *AddByPathRequest) (*AddByPathResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddByPath not implemented") +} +func (UnimplementedTreeServiceServer) Remove(context.Context, *RemoveRequest) (*RemoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented") +} +func (UnimplementedTreeServiceServer) Move(context.Context, *MoveRequest) (*MoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Move not implemented") +} +func (UnimplementedTreeServiceServer) GetNodeByPath(context.Context, *GetNodeByPathRequest) (*GetNodeByPathResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNodeByPath not implemented") +} +func (UnimplementedTreeServiceServer) GetSubTree(*GetSubTreeRequest, TreeService_GetSubTreeServer) error { + return status.Errorf(codes.Unimplemented, "method GetSubTree not implemented") +} +func (UnimplementedTreeServiceServer) TreeList(context.Context, *TreeListRequest) (*TreeListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TreeList not implemented") +} +func (UnimplementedTreeServiceServer) Apply(context.Context, *ApplyRequest) (*ApplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Apply not implemented") +} +func (UnimplementedTreeServiceServer) GetOpLog(*GetOpLogRequest, TreeService_GetOpLogServer) error { + return status.Errorf(codes.Unimplemented, "method GetOpLog not implemented") +} +func (UnimplementedTreeServiceServer) Healthcheck(context.Context, *HealthcheckRequest) (*HealthcheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Healthcheck not implemented") +} + +// UnsafeTreeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TreeServiceServer will +// result in compilation errors. +type UnsafeTreeServiceServer interface { + mustEmbedUnimplementedTreeServiceServer() +} + +func RegisterTreeServiceServer(s grpc.ServiceRegistrar, srv TreeServiceServer) { + s.RegisterService(&TreeService_ServiceDesc, srv) +} + +func _TreeService_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).Add(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_Add_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).Add(ctx, req.(*AddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_AddByPath_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddByPathRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).AddByPath(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_AddByPath_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).AddByPath(ctx, req.(*AddByPathRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).Remove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_Remove_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).Remove(ctx, req.(*RemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_Move_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).Move(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_Move_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).Move(ctx, req.(*MoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_GetNodeByPath_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNodeByPathRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).GetNodeByPath(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_GetNodeByPath_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).GetNodeByPath(ctx, req.(*GetNodeByPathRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_GetSubTree_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetSubTreeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(TreeServiceServer).GetSubTree(m, &treeServiceGetSubTreeServer{stream}) +} + +type TreeService_GetSubTreeServer interface { + Send(*GetSubTreeResponse) error + grpc.ServerStream +} + +type treeServiceGetSubTreeServer struct { + grpc.ServerStream +} + +func (x *treeServiceGetSubTreeServer) Send(m *GetSubTreeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _TreeService_TreeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TreeListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).TreeList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_TreeList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).TreeList(ctx, req.(*TreeListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_Apply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).Apply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_Apply_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).Apply(ctx, req.(*ApplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TreeService_GetOpLog_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetOpLogRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(TreeServiceServer).GetOpLog(m, &treeServiceGetOpLogServer{stream}) +} + +type TreeService_GetOpLogServer interface { + Send(*GetOpLogResponse) error + grpc.ServerStream +} + +type treeServiceGetOpLogServer struct { + grpc.ServerStream +} + +func (x *treeServiceGetOpLogServer) Send(m *GetOpLogResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _TreeService_Healthcheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthcheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TreeServiceServer).Healthcheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TreeService_Healthcheck_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TreeServiceServer).Healthcheck(ctx, req.(*HealthcheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TreeService_ServiceDesc is the grpc.ServiceDesc for TreeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TreeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "tree.TreeService", + HandlerType: (*TreeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Add", + Handler: _TreeService_Add_Handler, + }, + { + MethodName: "AddByPath", + Handler: _TreeService_AddByPath_Handler, + }, + { + MethodName: "Remove", + Handler: _TreeService_Remove_Handler, + }, + { + MethodName: "Move", + Handler: _TreeService_Move_Handler, + }, + { + MethodName: "GetNodeByPath", + Handler: _TreeService_GetNodeByPath_Handler, + }, + { + MethodName: "TreeList", + Handler: _TreeService_TreeList_Handler, + }, + { + MethodName: "Apply", + Handler: _TreeService_Apply_Handler, + }, + { + MethodName: "Healthcheck", + Handler: _TreeService_Healthcheck_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetSubTree", + Handler: _TreeService_GetSubTree_Handler, + ServerStreams: true, + }, + { + StreamName: "GetOpLog", + Handler: _TreeService_GetOpLog_Handler, + ServerStreams: true, + }, + }, + Metadata: "pkg/services/tree/service.proto", +} diff --git a/pool/tree/service/types.pb.go b/pool/tree/service/types.pb.go new file mode 100644 index 0000000..45d8891 --- /dev/null +++ b/pool/tree/service/types.pb.go @@ -0,0 +1,320 @@ +//* +// Auxiliary structures to use with tree service. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: pkg/services/tree/types.proto + +package tree + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// KeyValue represents key-value pair attached to an object. +type KeyValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Attribute name. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Attribute value. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *KeyValue) Reset() { + *x = KeyValue{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValue) ProtoMessage() {} + +func (x *KeyValue) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyValue.ProtoReflect.Descriptor instead. +func (*KeyValue) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_types_proto_rawDescGZIP(), []int{0} +} + +func (x *KeyValue) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KeyValue) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +// LogMove represents log-entry for a single move operation. +type LogMove struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID of the parent node. + ParentId uint64 `protobuf:"varint,1,opt,name=parent_id,json=parentID,proto3" json:"parent_id,omitempty"` + // Node meta information, including operation timestamp. + Meta []byte `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` + // ID of the node to move. + ChildId uint64 `protobuf:"varint,3,opt,name=child_id,json=childID,proto3" json:"child_id,omitempty"` +} + +func (x *LogMove) Reset() { + *x = LogMove{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogMove) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogMove) ProtoMessage() {} + +func (x *LogMove) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogMove.ProtoReflect.Descriptor instead. +func (*LogMove) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_types_proto_rawDescGZIP(), []int{1} +} + +func (x *LogMove) GetParentId() uint64 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *LogMove) GetMeta() []byte { + if x != nil { + return x.Meta + } + return nil +} + +func (x *LogMove) GetChildId() uint64 { + if x != nil { + return x.ChildId + } + return 0 +} + +// Signature of a message. +type Signature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Serialized public key as defined in FrostFS API. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Signature of a message body. + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` +} + +func (x *Signature) Reset() { + *x = Signature{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Signature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Signature) ProtoMessage() {} + +func (x *Signature) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Signature.ProtoReflect.Descriptor instead. +func (*Signature) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_types_proto_rawDescGZIP(), []int{2} +} + +func (x *Signature) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *Signature) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil +} + +var File_pkg_services_tree_types_proto protoreflect.FileDescriptor + +var file_pkg_services_tree_types_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74, + 0x72, 0x65, 0x65, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x04, 0x74, 0x72, 0x65, 0x65, 0x22, 0x32, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x07, 0x4c, 0x6f, 0x67, + 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, + 0x44, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x44, + 0x22, 0x36, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, + 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_services_tree_types_proto_rawDescOnce sync.Once + file_pkg_services_tree_types_proto_rawDescData = file_pkg_services_tree_types_proto_rawDesc +) + +func file_pkg_services_tree_types_proto_rawDescGZIP() []byte { + file_pkg_services_tree_types_proto_rawDescOnce.Do(func() { + file_pkg_services_tree_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_services_tree_types_proto_rawDescData) + }) + return file_pkg_services_tree_types_proto_rawDescData +} + +var file_pkg_services_tree_types_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_pkg_services_tree_types_proto_goTypes = []interface{}{ + (*KeyValue)(nil), // 0: tree.KeyValue + (*LogMove)(nil), // 1: tree.LogMove + (*Signature)(nil), // 2: tree.Signature +} +var file_pkg_services_tree_types_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_pkg_services_tree_types_proto_init() } +func file_pkg_services_tree_types_proto_init() { + if File_pkg_services_tree_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_services_tree_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogMove); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Signature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_services_tree_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pkg_services_tree_types_proto_goTypes, + DependencyIndexes: file_pkg_services_tree_types_proto_depIdxs, + MessageInfos: file_pkg_services_tree_types_proto_msgTypes, + }.Build() + File_pkg_services_tree_types_proto = out.File + file_pkg_services_tree_types_proto_rawDesc = nil + file_pkg_services_tree_types_proto_goTypes = nil + file_pkg_services_tree_types_proto_depIdxs = nil +} diff --git a/syncTree.sh b/syncTree.sh new file mode 100755 index 0000000..9bb758b --- /dev/null +++ b/syncTree.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +REVISION="f07d4158f50ed5c7f44cc0bc224c3d03edf27f3b" + +echo "tree service revision ${REVISION}" + +# regexp below find all link to source code files which end with ".pb.go" and retrieve the file names +# we use `[^.]*` as non greedy workaround for `.*` +FILES=$(curl -s https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/${REVISION}/pkg/services/tree | sed -n "s,.*\"/TrueCloudLab/frostfs-node/src/commit/${REVISION}/pkg/services/tree/\([^.]*\.pb\.go\)\".*,\1,p") + +for file in $FILES; do + if [[ $file == *"frostfs"* ]]; then + echo "skip '$file'" + continue + else + echo "sync '$file' in tree service" + fi + curl -s "https://git.frostfs.info/TrueCloudLab/frostfs-node/raw/commit/${REVISION}/pkg/services/tree/${file}" -o "./pool/tree/service/${file}" +done From 0d3dacb515428227d776299dea2bc5bccd978872 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 6 Jun 2023 09:28:51 +0300 Subject: [PATCH 023/323] [#73] pool: Add getters for NodeParam Signed-off-by: Denis Kirillov --- pool/pool.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pool/pool.go b/pool/pool.go index 7f4515d..d94f81b 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -1160,16 +1160,31 @@ func (x *NodeParam) SetPriority(priority int) { x.priority = priority } +// Priority returns priority of the node. +func (x *NodeParam) Priority() int { + return x.priority +} + // SetAddress specifies address of the node. func (x *NodeParam) SetAddress(address string) { x.address = address } +// Address returns address of the node. +func (x *NodeParam) Address() string { + return x.address +} + // SetWeight specifies weight of the node. func (x *NodeParam) SetWeight(weight float64) { x.weight = weight } +// Weight returns weight of the node. +func (x *NodeParam) Weight() float64 { + return x.weight +} + // WaitParams contains parameters used in polling is a something applied on FrostFS network. type WaitParams struct { timeout time.Duration From 51e022ab8c255ebf8f3e6582450d1cfa20ca2e65 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 6 Jun 2023 09:29:23 +0300 Subject: [PATCH 024/323] [#73] pool/tree: Add tree pool Signed-off-by: Denis Kirillov --- go.mod | 13 +- go.sum | 1 - pool/tree/client.go | 111 ++++++ pool/tree/pool.go | 745 ++++++++++++++++++++++++++++++++++++ pool/tree/pool_signature.go | 25 ++ 5 files changed, 884 insertions(+), 11 deletions(-) create mode 100644 pool/tree/client.go create mode 100644 pool/tree/pool.go create mode 100644 pool/tree/pool_signature.go diff --git a/go.mod b/go.mod index d3d7721..89f6fe3 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb + git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 github.com/antlr4-go/antlr/v4 v4.13.0 @@ -15,11 +16,12 @@ require ( github.com/stretchr/testify v1.8.3 go.uber.org/zap v1.24.0 google.golang.org/grpc v1.55.0 + google.golang.org/protobuf v1.30.0 ) require ( - git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 // indirect git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect + github.com/benbjohnson/clock v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -30,14 +32,6 @@ require ( github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/twmb/murmur3 v1.1.8 // indirect - go.opentelemetry.io/otel v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 // indirect - go.opentelemetry.io/otel/sdk v1.15.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect - go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/goleak v1.2.1 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -48,6 +42,5 @@ require ( golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1d4eb8e..a409e2f 100644 --- a/go.sum +++ b/go.sum @@ -335,7 +335,6 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/pool/tree/client.go b/pool/tree/client.go new file mode 100644 index 0000000..cbf8d53 --- /dev/null +++ b/pool/tree/client.go @@ -0,0 +1,111 @@ +package tree + +import ( + "context" + "fmt" + "sync" + + grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" + "google.golang.org/grpc" +) + +type treeClient struct { + mu sync.RWMutex + address string + opts []grpc.DialOption + conn *grpc.ClientConn + service grpcService.TreeServiceClient + healthy bool +} + +// newTreeClient creates new tree client with auto dial. +func newTreeClient(addr string, opts ...grpc.DialOption) *treeClient { + return &treeClient{ + address: addr, + opts: opts, + } +} + +func (c *treeClient) dial(ctx context.Context) error { + c.mu.Lock() + defer c.mu.Unlock() + + if c.conn != nil { + return fmt.Errorf("couldn't dial '%s': connection already established", c.address) + } + + var err error + c.conn, err = grpc.DialContext(ctx, c.address, c.opts...) + if err != nil { + return fmt.Errorf("grpc dial node tree service: %w", err) + } + + c.service = grpcService.NewTreeServiceClient(c.conn) + if _, err = c.service.Healthcheck(ctx, &grpcService.HealthcheckRequest{}); err != nil { + return fmt.Errorf("healthcheck tree service: %w", err) + } + + c.healthy = true + + return nil +} + +func (c *treeClient) redialIfNecessary(ctx context.Context) (healthHasChanged bool, err error) { + c.mu.Lock() + defer c.mu.Unlock() + + if c.conn == nil { + c.conn, err = grpc.DialContext(ctx, c.address, c.opts...) + if err != nil { + return false, fmt.Errorf("grpc dial node tree service: %w", err) + } + + c.service = grpcService.NewTreeServiceClient(c.conn) + } + + wasHealthy := c.healthy + if _, err = c.service.Healthcheck(ctx, &grpcService.HealthcheckRequest{}); err != nil { + c.healthy = false + return wasHealthy, fmt.Errorf("healthcheck tree service: %w", err) + } + + return !wasHealthy, nil +} + +func (c *treeClient) serviceClient() (grpcService.TreeServiceClient, error) { + c.mu.RLock() + defer c.mu.RUnlock() + + if c.conn == nil || !c.healthy { + return nil, fmt.Errorf("unhealthy endpoint: '%s'", c.address) + } + + return c.service, nil +} + +func (c *treeClient) endpoint() string { + return c.address +} + +func (c *treeClient) isHealthy() bool { + c.mu.RLock() + defer c.mu.RUnlock() + return c.healthy +} + +func (c *treeClient) setHealthy(val bool) { + c.mu.Lock() + defer c.mu.Unlock() + c.healthy = val +} + +func (c *treeClient) close() error { + c.mu.Lock() + defer c.mu.Unlock() + + if c.conn == nil { + return nil + } + + return c.conn.Close() +} diff --git a/pool/tree/pool.go b/pool/tree/pool.go new file mode 100644 index 0000000..3c6cdff --- /dev/null +++ b/pool/tree/pool.go @@ -0,0 +1,745 @@ +package tree + +import ( + "context" + "errors" + "fmt" + "io" + "sort" + "strings" + "sync" + "time" + + cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" + grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +const ( + defaultRebalanceInterval = 15 * time.Second + defaultHealthcheckTimeout = 4 * time.Second + defaultDialTimeout = 5 * time.Second + defaultStreamTimeout = 10 * time.Second +) + +var ( + // ErrNodeNotFound is returned from Tree service in case of not found error. + ErrNodeNotFound = errors.New("not found") + + // ErrNodeAccessDenied is returned from Tree service in case of access denied error. + ErrNodeAccessDenied = errors.New("access denied") +) + +// client represents virtual connection to the single FrostFS tree service from which Pool is formed. +// This interface is expected to have exactly one production implementation - treeClient. +// Others are expected to be for test purposes only. +type client interface { + serviceClient() (grpcService.TreeServiceClient, error) + endpoint() string + isHealthy() bool + setHealthy(bool) + dial(ctx context.Context) error + redialIfNecessary(context.Context) (bool, error) + close() error +} + +// InitParameters contains values used to initialize connection Pool. +type InitParameters struct { + key *keys.PrivateKey + logger *zap.Logger + nodeDialTimeout time.Duration + nodeStreamTimeout time.Duration + healthcheckTimeout time.Duration + clientRebalanceInterval time.Duration + nodeParams []pool.NodeParam +} + +// Pool represents virtual connection to the FrostFS tree services network to communicate +// with multiple FrostFS tree services without thinking about switching between servers +// due to their unavailability. +// +// Pool can be created and initialized using NewPool function. +// Before executing the FrostFS tree operations using the Pool, connection to the +// servers MUST BE correctly established (see Dial method). +type Pool struct { + innerPools []*innerPool + key *keys.PrivateKey + cancel context.CancelFunc + closedCh chan struct{} + rebalanceParams rebalanceParameters + logger *zap.Logger + + startIndicesMtx sync.RWMutex + // startIndices points to the client from which the next request will be executed. + // Since clients are stored in innerPool field we have to use two indices. + // These indices being changed during: + // * rebalance procedure (see Pool.startRebalance) + // * retry in case of request failure (see Pool.requestWithRetry) + startIndices [2]int +} + +type innerPool struct { + clients []client +} + +type rebalanceParameters struct { + nodesGroup [][]pool.NodeParam + nodeRequestTimeout time.Duration + clientRebalanceInterval time.Duration +} + +// GetNodesParams groups parameters of Pool.GetNodes operation. +type GetNodesParams struct { + CID cid.ID + TreeID string + Path []string + Meta []string + PathAttribute string + LatestOnly bool + AllAttrs bool + BearerToken []byte +} + +// GetSubTreeParams groups parameters of Pool.GetSubTree operation. +type GetSubTreeParams struct { + CID cid.ID + TreeID string + RootID uint64 + Depth uint32 + BearerToken []byte +} + +// AddNodeParams groups parameters of Pool.AddNode operation. +type AddNodeParams struct { + CID cid.ID + TreeID string + Parent uint64 + Meta map[string]string + BearerToken []byte +} + +// AddNodeByPathParams groups parameters of Pool.AddNodeByPath operation. +type AddNodeByPathParams struct { + CID cid.ID + TreeID string + Path []string + Meta map[string]string + PathAttribute string + BearerToken []byte +} + +// MoveNodeParams groups parameters of Pool.MoveNode operation. +type MoveNodeParams struct { + CID cid.ID + TreeID string + NodeID uint64 + ParentID uint64 + Meta map[string]string + BearerToken []byte +} + +// RemoveNodeParams groups parameters of Pool.RemoveNode operation. +type RemoveNodeParams struct { + CID cid.ID + TreeID string + NodeID uint64 + BearerToken []byte +} + +// NewPool creates connection pool using parameters. +func NewPool(options InitParameters) (*Pool, error) { + if options.key == nil { + return nil, fmt.Errorf("missed required parameter 'Key'") + } + + nodesParams, err := adjustNodeParams(options.nodeParams) + if err != nil { + return nil, err + } + + fillDefaultInitParams(&options) + + p := &Pool{ + key: options.key, + logger: options.logger, + rebalanceParams: rebalanceParameters{ + nodesGroup: nodesParams, + nodeRequestTimeout: options.healthcheckTimeout, + clientRebalanceInterval: options.clientRebalanceInterval, + }, + } + + return p, nil +} + +// Dial establishes a connection to the tree servers from the FrostFS network. +// It also starts a routine that checks the health of the nodes and +// updates the weights of the nodes for balancing. +// Returns an error describing failure reason. +// +// If failed, the Pool SHOULD NOT be used. +// +// See also InitParameters.SetClientRebalanceInterval. +func (p *Pool) Dial(ctx context.Context) error { + inner := make([]*innerPool, len(p.rebalanceParams.nodesGroup)) + var atLeastOneHealthy bool + + for i, nodes := range p.rebalanceParams.nodesGroup { + clients := make([]client, len(nodes)) + for j, node := range nodes { + clients[j] = newTreeClient(node.Address(), grpc.WithTransportCredentials(insecure.NewCredentials())) + if err := clients[j].dial(ctx); err != nil { + p.log(zap.WarnLevel, "failed to build client", zap.String("address", node.Address()), zap.Error(err)) + continue + } + + atLeastOneHealthy = true + } + + inner[i] = &innerPool{ + clients: clients, + } + } + + if !atLeastOneHealthy { + return fmt.Errorf("at least one node must be healthy") + } + + ctx, cancel := context.WithCancel(ctx) + p.cancel = cancel + p.closedCh = make(chan struct{}) + p.innerPools = inner + + go p.startRebalance(ctx) + return nil +} + +// SetKey specifies default key to be used for the protocol communication by default. +func (x *InitParameters) SetKey(key *keys.PrivateKey) { + x.key = key +} + +// SetLogger specifies logger. +func (x *InitParameters) SetLogger(logger *zap.Logger) { + x.logger = logger +} + +// SetNodeDialTimeout specifies the timeout for connection to be established. +func (x *InitParameters) SetNodeDialTimeout(timeout time.Duration) { + x.nodeDialTimeout = timeout +} + +// SetNodeStreamTimeout specifies the timeout for individual operations in streaming RPC. +func (x *InitParameters) SetNodeStreamTimeout(timeout time.Duration) { + x.nodeStreamTimeout = timeout +} + +// SetHealthcheckTimeout specifies the timeout for request to node to decide if it is alive. +// +// See also Pool.Dial. +func (x *InitParameters) SetHealthcheckTimeout(timeout time.Duration) { + x.healthcheckTimeout = timeout +} + +// SetClientRebalanceInterval specifies the interval for updating nodes health status. +// +// See also Pool.Dial. +func (x *InitParameters) SetClientRebalanceInterval(interval time.Duration) { + x.clientRebalanceInterval = interval +} + +// AddNode append information about the node to which you want to connect. +func (x *InitParameters) AddNode(nodeParam pool.NodeParam) { + x.nodeParams = append(x.nodeParams, nodeParam) +} + +// GetNodes invokes eponymous method from TreeServiceClient. +// +// Can return predefined errors: +// * ErrNodeNotFound +// * ErrNodeAccessDenied. +func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*grpcService.GetNodeByPathResponse_Info, error) { + request := &grpcService.GetNodeByPathRequest{ + Body: &grpcService.GetNodeByPathRequest_Body{ + ContainerId: prm.CID[:], + TreeId: prm.TreeID, + Path: prm.Path, + Attributes: prm.Meta, + PathAttribute: prm.PathAttribute, + LatestOnly: prm.LatestOnly, + AllAttributes: prm.AllAttrs, + BearerToken: prm.BearerToken, + }, + } + + if err := p.signRequest(request.Body, func(key, sign []byte) { + request.Signature = &grpcService.Signature{ + Key: key, + Sign: sign, + } + }); err != nil { + return nil, err + } + + var resp *grpcService.GetNodeByPathResponse + if err := p.requestWithRetry(func(client grpcService.TreeServiceClient) (inErr error) { + resp, inErr = client.GetNodeByPath(ctx, request) + return handleError("failed to get node by path", inErr) + }); err != nil { + return nil, err + } + + return resp.GetBody().GetNodes(), nil +} + +// SubTreeReader is designed to read list of subtree nodes FrostFS tree service. +// +// Must be initialized using Pool.GetSubTree, any other usage is unsafe. +type SubTreeReader struct { + cli grpcService.TreeService_GetSubTreeClient +} + +// Read reads another list of the subtree nodes. +func (x *SubTreeReader) Read(buf []*grpcService.GetSubTreeResponse_Body) (int, error) { + for i := 0; i < len(buf); i++ { + resp, err := x.cli.Recv() + if err == io.EOF { + return i, io.EOF + } else if err != nil { + return i, handleError("failed to get sub tree", err) + } + buf[i] = resp.Body + } + + return len(buf), nil +} + +// ReadAll reads all nodes subtree nodes. +func (x *SubTreeReader) ReadAll() ([]*grpcService.GetSubTreeResponse_Body, error) { + var res []*grpcService.GetSubTreeResponse_Body + for { + resp, err := x.cli.Recv() + if err == io.EOF { + break + } else if err != nil { + return nil, handleError("failed to get sub tree", err) + } + res = append(res, resp.Body) + } + + return res, nil +} + +// Next gets the next node from subtree. +func (x *SubTreeReader) Next() (*grpcService.GetSubTreeResponse_Body, error) { + resp, err := x.cli.Recv() + if err == io.EOF { + return nil, io.EOF + } + if err != nil { + return nil, handleError("failed to get sub tree", err) + } + + return resp.Body, nil +} + +// GetSubTree invokes eponymous method from TreeServiceClient. +// +// Can return predefined errors: +// * ErrNodeNotFound +// * ErrNodeAccessDenied. +func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeReader, error) { + request := &grpcService.GetSubTreeRequest{ + Body: &grpcService.GetSubTreeRequest_Body{ + ContainerId: prm.CID[:], + TreeId: prm.TreeID, + RootId: prm.RootID, + Depth: prm.Depth, + BearerToken: prm.BearerToken, + }, + } + + if err := p.signRequest(request.Body, func(key, sign []byte) { + request.Signature = &grpcService.Signature{ + Key: key, + Sign: sign, + } + }); err != nil { + return nil, err + } + + var cli grpcService.TreeService_GetSubTreeClient + if err := p.requestWithRetry(func(client grpcService.TreeServiceClient) (inErr error) { + cli, inErr = client.GetSubTree(ctx, request) + return handleError("failed to get sub tree client", inErr) + }); err != nil { + return nil, err + } + + return &SubTreeReader{cli: cli}, nil +} + +// AddNode invokes eponymous method from TreeServiceClient. +// +// Can return predefined errors: +// * ErrNodeNotFound +// * ErrNodeAccessDenied. +func (p *Pool) AddNode(ctx context.Context, prm AddNodeParams) (uint64, error) { + request := &grpcService.AddRequest{ + Body: &grpcService.AddRequest_Body{ + ContainerId: prm.CID[:], + TreeId: prm.TreeID, + ParentId: prm.Parent, + Meta: metaToKV(prm.Meta), + BearerToken: prm.BearerToken, + }, + } + if err := p.signRequest(request.Body, func(key, sign []byte) { + request.Signature = &grpcService.Signature{ + Key: key, + Sign: sign, + } + }); err != nil { + return 0, err + } + + var resp *grpcService.AddResponse + if err := p.requestWithRetry(func(client grpcService.TreeServiceClient) (inErr error) { + resp, inErr = client.Add(ctx, request) + return handleError("failed to add node", inErr) + }); err != nil { + return 0, err + } + + return resp.GetBody().GetNodeId(), nil +} + +// AddNodeByPath invokes eponymous method from TreeServiceClient. +// +// Can return predefined errors: +// * ErrNodeNotFound +// * ErrNodeAccessDenied. +func (p *Pool) AddNodeByPath(ctx context.Context, prm AddNodeByPathParams) (uint64, error) { + request := &grpcService.AddByPathRequest{ + Body: &grpcService.AddByPathRequest_Body{ + ContainerId: prm.CID[:], + TreeId: prm.TreeID, + Path: prm.Path, + Meta: metaToKV(prm.Meta), + PathAttribute: prm.PathAttribute, + BearerToken: prm.BearerToken, + }, + } + + if err := p.signRequest(request.Body, func(key, sign []byte) { + request.Signature = &grpcService.Signature{ + Key: key, + Sign: sign, + } + }); err != nil { + return 0, err + } + + var resp *grpcService.AddByPathResponse + if err := p.requestWithRetry(func(client grpcService.TreeServiceClient) (inErr error) { + resp, inErr = client.AddByPath(ctx, request) + return handleError("failed to add node by path", inErr) + }); err != nil { + return 0, err + } + + body := resp.GetBody() + if body == nil { + return 0, errors.New("nil body in tree service response") + } else if len(body.Nodes) == 0 { + return 0, errors.New("empty list of added nodes in tree service response") + } + + // The first node is the leaf that we add, according to tree service docs. + return body.Nodes[0], nil +} + +// MoveNode invokes eponymous method from TreeServiceClient. +// +// Can return predefined errors: +// * ErrNodeNotFound +// * ErrNodeAccessDenied. +func (p *Pool) MoveNode(ctx context.Context, prm MoveNodeParams) error { + request := &grpcService.MoveRequest{ + Body: &grpcService.MoveRequest_Body{ + ContainerId: prm.CID[:], + TreeId: prm.TreeID, + NodeId: prm.NodeID, + ParentId: prm.ParentID, + Meta: metaToKV(prm.Meta), + BearerToken: prm.BearerToken, + }, + } + + if err := p.signRequest(request.Body, func(key, sign []byte) { + request.Signature = &grpcService.Signature{ + Key: key, + Sign: sign, + } + }); err != nil { + return err + } + + return p.requestWithRetry(func(client grpcService.TreeServiceClient) error { + if _, err := client.Move(ctx, request); err != nil { + return handleError("failed to move node", err) + } + return nil + }) +} + +// RemoveNode invokes eponymous method from TreeServiceClient. +// +// Can return predefined errors: +// * ErrNodeNotFound +// * ErrNodeAccessDenied. +func (p *Pool) RemoveNode(ctx context.Context, prm RemoveNodeParams) error { + request := &grpcService.RemoveRequest{ + Body: &grpcService.RemoveRequest_Body{ + ContainerId: prm.CID[:], + TreeId: prm.TreeID, + NodeId: prm.NodeID, + BearerToken: prm.BearerToken, + }, + } + if err := p.signRequest(request.Body, func(key, sign []byte) { + request.Signature = &grpcService.Signature{ + Key: key, + Sign: sign, + } + }); err != nil { + return err + } + + return p.requestWithRetry(func(client grpcService.TreeServiceClient) error { + if _, err := client.Remove(ctx, request); err != nil { + return handleError("failed to remove node", err) + } + return nil + }) +} + +// Close closes the Pool and releases all the associated resources. +func (p *Pool) Close() error { + p.cancel() + <-p.closedCh + + var err error + for _, group := range p.innerPools { + for _, cl := range group.clients { + if closeErr := cl.close(); closeErr != nil { + p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr)) + err = closeErr + } + } + } + + return err +} + +func handleError(msg string, err error) error { + if err == nil { + return nil + } + if strings.Contains(err.Error(), "not found") { + return fmt.Errorf("%w: %s", ErrNodeNotFound, err.Error()) + } else if strings.Contains(err.Error(), "is denied by") { + return fmt.Errorf("%w: %s", ErrNodeAccessDenied, err.Error()) + } + return fmt.Errorf("%s: %w", msg, err) +} + +func metaToKV(meta map[string]string) []*grpcService.KeyValue { + result := make([]*grpcService.KeyValue, 0, len(meta)) + + for key, value := range meta { + result = append(result, &grpcService.KeyValue{Key: key, Value: []byte(value)}) + } + + return result +} + +func adjustNodeParams(nodeParams []pool.NodeParam) ([][]pool.NodeParam, error) { + if len(nodeParams) == 0 { + return nil, errors.New("no FrostFS peers configured") + } + + nodeParamsMap := make(map[int][]pool.NodeParam) + for _, param := range nodeParams { + nodes := nodeParamsMap[param.Priority()] + nodeParamsMap[param.Priority()] = append(nodes, param) + } + + res := make([][]pool.NodeParam, 0, len(nodeParamsMap)) + for _, nodes := range nodeParamsMap { + res = append(res, nodes) + } + + sort.Slice(res, func(i, j int) bool { + return res[i][0].Priority() < res[j][0].Priority() + }) + + return res, nil +} + +func fillDefaultInitParams(params *InitParameters) { + if params.clientRebalanceInterval <= 0 { + params.clientRebalanceInterval = defaultRebalanceInterval + } + + if params.healthcheckTimeout <= 0 { + params.healthcheckTimeout = defaultHealthcheckTimeout + } + + if params.nodeDialTimeout <= 0 { + params.nodeDialTimeout = defaultDialTimeout + } + + if params.nodeStreamTimeout <= 0 { + params.nodeStreamTimeout = defaultStreamTimeout + } +} + +func (p *Pool) log(level zapcore.Level, msg string, fields ...zap.Field) { + if p.logger == nil { + return + } + + p.logger.Log(level, msg, fields...) +} + +// startRebalance runs loop to monitor tree client healthy status. +func (p *Pool) startRebalance(ctx context.Context) { + ticker := time.NewTimer(p.rebalanceParams.clientRebalanceInterval) + buffers := make([][]bool, len(p.rebalanceParams.nodesGroup)) + for i, nodes := range p.rebalanceParams.nodesGroup { + buffers[i] = make([]bool, len(nodes)) + } + + for { + select { + case <-ctx.Done(): + close(p.closedCh) + return + case <-ticker.C: + p.updateNodesHealth(ctx, buffers) + ticker.Reset(p.rebalanceParams.clientRebalanceInterval) + } + } +} + +func (p *Pool) updateNodesHealth(ctx context.Context, buffers [][]bool) { + wg := sync.WaitGroup{} + for i, inner := range p.innerPools { + wg.Add(1) + + go func(i int, innerPool *innerPool) { + defer wg.Done() + p.updateInnerNodesHealth(ctx, i, buffers[i]) + }(i, inner) + } + wg.Wait() + +LOOP: + for i, buffer := range buffers { + for j, healthy := range buffer { + if healthy { + p.setStartIndices(i, j) + break LOOP + } + } + } +} + +func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, buffer []bool) { + if i > len(p.innerPools)-1 { + return + } + nodesByPriority := p.innerPools[i] + options := p.rebalanceParams + + var wg sync.WaitGroup + for j, cli := range nodesByPriority.clients { + wg.Add(1) + go func(j int, cli client) { + defer wg.Done() + + tctx, c := context.WithTimeout(ctx, options.nodeRequestTimeout) + defer c() + + changed, err := cli.redialIfNecessary(tctx) + healthy := err == nil + if changed { + fields := []zap.Field{zap.String("address", cli.endpoint()), zap.Bool("healthy", healthy)} + if err != nil { + fields = append(fields, zap.Error(err)) + } + p.log(zap.DebugLevel, "tree health has changed", fields...) + } else if err != nil { + p.log(zap.DebugLevel, "tree redial error", zap.String("address", cli.endpoint()), zap.Error(err)) + } + buffer[j] = healthy + }(j, cli) + } + wg.Wait() +} + +func (p *Pool) getStartIndices() (int, int) { + p.startIndicesMtx.RLock() + defer p.startIndicesMtx.RUnlock() + + return p.startIndices[0], p.startIndices[1] +} + +func (p *Pool) setStartIndices(i, j int) { + p.startIndicesMtx.Lock() + p.startIndices[0] = i + p.startIndices[1] = j + p.startIndicesMtx.Unlock() +} + +func (p *Pool) requestWithRetry(fn func(client grpcService.TreeServiceClient) error) error { + var ( + err error + cl grpcService.TreeServiceClient + ) + + startI, startJ := p.getStartIndices() + groupsLen := len(p.innerPools) + for i := startI; i < startI+groupsLen; i++ { + indexI := i % groupsLen + clientsLen := len(p.innerPools[i].clients) + for j := startJ; j < startJ+clientsLen; j++ { + indexJ := j % clientsLen + if cl, err = p.innerPools[indexI].clients[indexJ].serviceClient(); err == nil { + err = fn(cl) + } + if !shouldTryAgain(err) { + if startI != indexI || startJ != indexJ { + p.setStartIndices(indexI, indexJ) + } + return err + } + p.log(zap.DebugLevel, "tree request error", zap.String("address", p.innerPools[indexI].clients[indexJ].endpoint()), zap.Error(err)) + } + startJ = 0 + } + + return err +} + +func shouldTryAgain(err error) bool { + return !(err == nil || + errors.Is(err, ErrNodeNotFound) || + errors.Is(err, ErrNodeAccessDenied)) +} diff --git a/pool/tree/pool_signature.go b/pool/tree/pool_signature.go new file mode 100644 index 0000000..0b3a2f6 --- /dev/null +++ b/pool/tree/pool_signature.go @@ -0,0 +1,25 @@ +package tree + +import ( + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" + "google.golang.org/protobuf/proto" +) + +func (p *Pool) signData(buf []byte, f func(key, sign []byte)) error { + sign, err := crypto.Sign(&p.key.PrivateKey, buf) + if err != nil { + return err + } + + f(p.key.PublicKey().Bytes(), sign) + return nil +} + +func (p *Pool) signRequest(requestBody proto.Message, f func(key, sign []byte)) error { + buf, err := proto.Marshal(requestBody) + if err != nil { + return err + } + + return p.signData(buf, f) +} From 19adb4dffaa40025f6ae1977225a4c8226924b42 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 6 Jun 2023 09:29:40 +0300 Subject: [PATCH 025/323] [#73] pool/tree: Add tests Signed-off-by: Denis Kirillov --- pool/tree/pool_test.go | 294 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 294 insertions(+) create mode 100644 pool/tree/pool_test.go diff --git a/pool/tree/pool_test.go b/pool/tree/pool_test.go new file mode 100644 index 0000000..8c8a0cf --- /dev/null +++ b/pool/tree/pool_test.go @@ -0,0 +1,294 @@ +package tree + +import ( + "context" + "errors" + grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" +) + +type treeClientMock struct { + address string + err bool +} + +func (t *treeClientMock) serviceClient() (grpcService.TreeServiceClient, error) { + if t.err { + return nil, errors.New("serviceClient() mock error") + } + return nil, nil +} + +func (t *treeClientMock) endpoint() string { + return t.address +} + +func (t *treeClientMock) isHealthy() bool { + return true +} + +func (t *treeClientMock) setHealthy(bool) { + return +} + +func (t *treeClientMock) dial(context.Context) error { + return nil +} + +func (t *treeClientMock) redialIfNecessary(context.Context) (bool, error) { + if t.err { + return false, errors.New("redialIfNecessary() mock error") + } + return false, nil +} + +func (t *treeClientMock) close() error { + return nil +} + +func TestHandleError(t *testing.T) { + defaultError := errors.New("default error") + for _, tc := range []struct { + err error + expectedError error + }{ + { + err: defaultError, + expectedError: defaultError, + }, + { + err: errors.New("something not found"), + expectedError: ErrNodeNotFound, + }, + { + err: errors.New("something is denied by some acl rule"), + expectedError: ErrNodeAccessDenied, + }, + } { + t.Run("", func(t *testing.T) { + err := handleError("err message", tc.err) + require.True(t, errors.Is(err, tc.expectedError)) + }) + } +} + +func TestRetry(t *testing.T) { + nodes := [][]string{ + {"node00", "node01", "node02", "node03"}, + {"node10", "node11", "node12", "node13"}, + } + + p := &Pool{ + logger: zaptest.NewLogger(t), + innerPools: makeInnerPool(nodes), + } + + makeFn := func(client grpcService.TreeServiceClient) error { + return nil + } + + t.Run("first ok", func(t *testing.T) { + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 0, 0) + }) + + t.Run("first failed", func(t *testing.T) { + setErrors(p, "node00") + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 0, 1) + }) + + t.Run("all failed", func(t *testing.T) { + setErrors(p, nodes[0]...) + setErrors(p, nodes[1]...) + err := p.requestWithRetry(makeFn) + require.Error(t, err) + checkIndicesAndReset(t, p, 0, 0) + }) + + t.Run("round", func(t *testing.T) { + setErrors(p, nodes[0][0], nodes[0][1]) + setErrors(p, nodes[1]...) + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndices(t, p, 0, 2) + resetClientsErrors(p) + + setErrors(p, nodes[0][2], nodes[0][3]) + err = p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 0, 0) + }) + + t.Run("group switch", func(t *testing.T) { + setErrors(p, nodes[0]...) + setErrors(p, nodes[1][0]) + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 1, 1) + }) + + t.Run("group round", func(t *testing.T) { + setErrors(p, nodes[0][1:]...) + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 0, 0) + }) + + t.Run("group round switch", func(t *testing.T) { + setErrors(p, nodes[0]...) + p.setStartIndices(0, 1) + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 1, 0) + }) +} + +func TestRebalance(t *testing.T) { + nodes := [][]string{ + {"node00", "node01"}, + {"node10", "node11"}, + } + + p := &Pool{ + logger: zaptest.NewLogger(t), + innerPools: makeInnerPool(nodes), + rebalanceParams: rebalanceParameters{ + nodesGroup: makeNodesGroup(nodes), + }, + } + + ctx := context.Background() + buffers := makeBuffer(p) + + t.Run("check dirty buffers", func(t *testing.T) { + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 0, 0) + setErrors(p, nodes[0][0]) + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 0, 1) + resetClients(p) + }) + + t.Run("don't change healthy status", func(t *testing.T) { + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 0, 0) + resetClients(p) + }) + + t.Run("switch to second group", func(t *testing.T) { + setErrors(p, nodes[0][0], nodes[0][1]) + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 1, 0) + resetClients(p) + }) + + t.Run("switch back and forth", func(t *testing.T) { + setErrors(p, nodes[0][0], nodes[0][1]) + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 1, 0) + + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 1, 0) + + setNoErrors(p, nodes[0][0]) + p.updateNodesHealth(ctx, buffers) + checkIndices(t, p, 0, 0) + + resetClients(p) + }) +} + +func makeInnerPool(nodes [][]string) []*innerPool { + res := make([]*innerPool, len(nodes)) + + for i, group := range nodes { + res[i] = &innerPool{clients: make([]client, len(group))} + for j, node := range group { + res[i].clients[j] = &treeClientMock{address: node} + } + } + + return res +} + +func makeNodesGroup(nodes [][]string) [][]pool.NodeParam { + res := make([][]pool.NodeParam, len(nodes)) + + for i, group := range nodes { + res[i] = make([]pool.NodeParam, len(group)) + for j, node := range group { + res[i][j] = pool.NewNodeParam(1, node, 1) + } + } + + return res +} + +func makeBuffer(p *Pool) [][]bool { + buffers := make([][]bool, len(p.rebalanceParams.nodesGroup)) + for i, nodes := range p.rebalanceParams.nodesGroup { + buffers[i] = make([]bool, len(nodes)) + } + return buffers +} + +func checkIndicesAndReset(t *testing.T, p *Pool, iExp, jExp int) { + checkIndices(t, p, iExp, jExp) + resetClients(p) +} + +func checkIndices(t *testing.T, p *Pool, iExp, jExp int) { + i, j := p.getStartIndices() + require.Equal(t, iExp, i) + require.Equal(t, jExp, j) +} + +func resetClients(p *Pool) { + resetClientsErrors(p) + p.setStartIndices(0, 0) +} + +func resetClientsErrors(p *Pool) { + for _, group := range p.innerPools { + for _, cl := range group.clients { + node := cl.(*treeClientMock) + node.err = false + } + } +} + +func setErrors(p *Pool, nodes ...string) { + setErrorsBase(p, true, nodes...) +} + +func setNoErrors(p *Pool, nodes ...string) { + setErrorsBase(p, false, nodes...) +} + +func setErrorsBase(p *Pool, err bool, nodes ...string) { + for _, group := range p.innerPools { + for _, cl := range group.clients { + node := cl.(*treeClientMock) + if containsStr(nodes, node.address) { + node.err = err + } + } + } +} + +func containsStr(list []string, item string) bool { + for i := range list { + if list[i] == item { + return true + } + } + + return false +} From 981d24a493b2ede319e1d376308d7e206fe2c1b0 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 8 Jun 2023 15:54:48 +0300 Subject: [PATCH 026/323] [#84] pool: Allow to pass gRPC dial options Signed-off-by: Denis Kirillov --- pool/pool.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pool/pool.go b/pool/pool.go index d94f81b..b56c574 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -32,6 +32,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "go.uber.org/zap" "go.uber.org/zap/zapcore" + "google.golang.org/grpc" ) // client represents virtual connection to the single FrostFS network endpoint from which Pool is formed. @@ -238,6 +239,7 @@ type wrapperPrm struct { errorThreshold uint32 responseInfoCallback func(sdkClient.ResponseMetaInfo) error poolRequestInfoCallback func(RequestInfo) + dialOptions []grpc.DialOption } // setAddress sets endpoint to connect in FrostFS network. @@ -276,6 +278,11 @@ func (x *wrapperPrm) setResponseInfoCallback(f func(sdkClient.ResponseMetaInfo) x.responseInfoCallback = f } +// setGRPCDialOptions sets the gRPC dial options for new gRPC client connection. +func (x *wrapperPrm) setGRPCDialOptions(opts []grpc.DialOption) { + x.dialOptions = opts +} + // newWrapper creates a clientWrapper that implements the client interface. func newWrapper(prm wrapperPrm) *clientWrapper { var cl sdkClient.Client @@ -307,6 +314,7 @@ func (c *clientWrapper) dial(ctx context.Context) error { prmDial.SetServerURI(c.prm.address) prmDial.SetTimeout(c.prm.dialTimeout) prmDial.SetStreamTimeout(c.prm.streamTimeout) + prmDial.SetGRPCDialOptions(c.prm.dialOptions...) if err = cl.Dial(ctx, prmDial); err != nil { c.setUnhealthy() @@ -337,6 +345,7 @@ func (c *clientWrapper) restartIfUnhealthy(ctx context.Context) (healthy, change prmDial.SetServerURI(c.prm.address) prmDial.SetTimeout(c.prm.dialTimeout) prmDial.SetStreamTimeout(c.prm.streamTimeout) + prmDial.SetGRPCDialOptions(c.prm.dialOptions...) if err := cl.Dial(ctx, prmDial); err != nil { c.setUnhealthy() @@ -1054,6 +1063,7 @@ type InitParameters struct { errorThreshold uint32 nodeParams []NodeParam requestCallback func(RequestInfo) + dialOptions []grpc.DialOption clientBuilder clientBuilder } @@ -1113,6 +1123,11 @@ func (x *InitParameters) AddNode(nodeParam NodeParam) { x.nodeParams = append(x.nodeParams, nodeParam) } +// SetGRPCDialOptions sets the gRPC dial options for new gRPC client connection. +func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption) { + x.dialOptions = opts +} + // setClientBuilder sets clientBuilder used for client construction. // Wraps setClientBuilderContext without a context. func (x *InitParameters) setClientBuilder(builder clientBuilder) { @@ -1735,6 +1750,7 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { prm.setStreamTimeout(params.nodeStreamTimeout) prm.setErrorThreshold(params.errorThreshold) prm.setPoolRequestCallback(params.requestCallback) + prm.setGRPCDialOptions(params.dialOptions) prm.setResponseInfoCallback(func(info sdkClient.ResponseMetaInfo) error { cache.updateEpoch(info.Epoch()) return nil From af40dc68f005778c5452e9b5255e25ebeb6c719d Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 8 Jun 2023 15:55:07 +0300 Subject: [PATCH 027/323] [#84] pool/tree: Allow to pass gRPC dial options Signed-off-by: Denis Kirillov --- pool/tree/pool.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pool/tree/pool.go b/pool/tree/pool.go index 3c6cdff..171a627 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -17,7 +17,6 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) const ( @@ -57,6 +56,7 @@ type InitParameters struct { healthcheckTimeout time.Duration clientRebalanceInterval time.Duration nodeParams []pool.NodeParam + dialOptions []grpc.DialOption } // Pool represents virtual connection to the FrostFS tree services network to communicate @@ -72,6 +72,7 @@ type Pool struct { cancel context.CancelFunc closedCh chan struct{} rebalanceParams rebalanceParameters + dialOptions []grpc.DialOption logger *zap.Logger startIndicesMtx sync.RWMutex @@ -165,8 +166,9 @@ func NewPool(options InitParameters) (*Pool, error) { fillDefaultInitParams(&options) p := &Pool{ - key: options.key, - logger: options.logger, + key: options.key, + logger: options.logger, + dialOptions: options.dialOptions, rebalanceParams: rebalanceParameters{ nodesGroup: nodesParams, nodeRequestTimeout: options.healthcheckTimeout, @@ -192,7 +194,7 @@ func (p *Pool) Dial(ctx context.Context) error { for i, nodes := range p.rebalanceParams.nodesGroup { clients := make([]client, len(nodes)) for j, node := range nodes { - clients[j] = newTreeClient(node.Address(), grpc.WithTransportCredentials(insecure.NewCredentials())) + clients[j] = newTreeClient(node.Address(), p.dialOptions...) if err := clients[j].dial(ctx); err != nil { p.log(zap.WarnLevel, "failed to build client", zap.String("address", node.Address()), zap.Error(err)) continue @@ -258,6 +260,11 @@ func (x *InitParameters) AddNode(nodeParam pool.NodeParam) { x.nodeParams = append(x.nodeParams, nodeParam) } +// SetGRPCDialOptions sets the gRPC dial options for new gRPC tree client connection. +func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption) { + x.dialOptions = opts +} + // GetNodes invokes eponymous method from TreeServiceClient. // // Can return predefined errors: From 9d40228cecbee13c2026f9b7992aebca431387f0 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 8 Jun 2023 17:01:33 +0300 Subject: [PATCH 028/323] [#73] pool/tree: Fix client healthy status Signed-off-by: Denis Kirillov --- pool/tree/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pool/tree/client.go b/pool/tree/client.go index cbf8d53..60377db 100644 --- a/pool/tree/client.go +++ b/pool/tree/client.go @@ -69,6 +69,8 @@ func (c *treeClient) redialIfNecessary(ctx context.Context) (healthHasChanged bo return wasHealthy, fmt.Errorf("healthcheck tree service: %w", err) } + c.healthy = true + return !wasHealthy, nil } From aa8ffebc632840847215a39bfe69d64ad9571bf6 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 23 Jun 2023 13:34:42 +0300 Subject: [PATCH 029/323] [#95] transformer: Set parent version Signed-off-by: Dmitrii Stepanov --- object/transformer/transformer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index 56a7f07..a175662 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -82,10 +82,12 @@ func (s *payloadSizeLimiter) initialize() { if ln := len(s.previous); ln > 0 { // initialize parent object once (after 1st object) if ln == 1 { + ver := version.Current() s.parent = fromObject(s.current) s.parent.ResetRelations() s.parent.SetSignature(nil) s.parent.SetAttributes(s.parAttrs...) + s.parent.SetVersion(&ver) s.parentHashers = append(s.parentHashers[:0], s.currentHashers...) } From c243b443bce6b4d82b105d62e7ff75dee833ac50 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 26 Jun 2023 18:13:04 +0300 Subject: [PATCH 030/323] [#80] objectwriter: Allow custimize maxChunkLen Signed-off-by: Dmitrii Stepanov --- client/object_put.go | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/client/object_put.go b/client/object_put.go index 3486907..d56a6fc 100644 --- a/client/object_put.go +++ b/client/object_put.go @@ -22,9 +22,10 @@ import ( // PrmObjectPutInit groups parameters of ObjectPutInit operation. type PrmObjectPutInit struct { - copyNum []uint32 - key *ecdsa.PrivateKey - meta v2session.RequestMetaHeader + copyNum []uint32 + key *ecdsa.PrivateKey + meta v2session.RequestMetaHeader + maxChunkLen int } // SetCopiesNumber sets number of object copies that is enough to consider put successful. @@ -39,6 +40,15 @@ func (x *PrmObjectPutInit) SetCopiesNumberByVectors(copiesNumbers []uint32) { x.copyNum = copiesNumbers } +// SetGRPCPayloadChunkLen sets maximum chunk length value for gRPC Put request. +// Maximum chunk length restricts maximum byte length of the chunk +// transmitted in a single stream message. It depends on +// server settings and other message fields. +// If not specified or negative value set, default value of 3MiB will be used. +func (x *PrmObjectPutInit) SetGRPCPayloadChunkLen(v int) { + x.maxChunkLen = v +} + // ResObjectPut groups the final result values of ObjectPutInit operation. type ResObjectPut struct { statusRes @@ -74,6 +84,8 @@ type ObjectWriter struct { req v2object.PutRequest partInit v2object.PutObjectPartInit partChunk v2object.PutObjectPartChunk + + maxChunkLen int } // UseKey specifies private key to sign the requests. @@ -143,15 +155,8 @@ func (x *ObjectWriter) WritePayloadChunk(chunk []byte) bool { } for ln := len(chunk); ln > 0; ln = len(chunk) { - // maxChunkLen restricts maximum byte length of the chunk - // transmitted in a single stream message. It depends on - // server settings and other message fields, but for now - // we simply assume that 3MB is large enough to reduce the - // number of messages, and not to exceed the limit - // (4MB by default for gRPC servers). - const maxChunkLen = 3 << 20 - if ln > maxChunkLen { - ln = maxChunkLen + if ln > x.maxChunkLen { + ln = x.maxChunkLen } // we deal with size limit overflow above, but there is another case: @@ -263,6 +268,11 @@ func (c *Client) ObjectPutInit(ctx context.Context, prm PrmObjectPutInit) (*Obje w.stream = stream w.partInit.SetCopiesNumber(prm.copyNum) w.req.SetBody(new(v2object.PutRequestBody)) + if prm.maxChunkLen > 0 { + w.maxChunkLen = prm.maxChunkLen + } else { + w.maxChunkLen = 3 << 20 + } c.prepareRequest(&w.req, &prm.meta) return &w, nil From 91e80ba7436e14897eb133bc19523518adc78265 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 28 Jun 2023 13:06:23 +0300 Subject: [PATCH 031/323] [#73] pool/tree: Fix index in retry loop Signed-off-by: Denis Kirillov --- pool/tree/pool.go | 2 +- pool/tree/pool_test.go | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pool/tree/pool.go b/pool/tree/pool.go index 171a627..ff155dc 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -725,7 +725,7 @@ func (p *Pool) requestWithRetry(fn func(client grpcService.TreeServiceClient) er groupsLen := len(p.innerPools) for i := startI; i < startI+groupsLen; i++ { indexI := i % groupsLen - clientsLen := len(p.innerPools[i].clients) + clientsLen := len(p.innerPools[indexI].clients) for j := startJ; j < startJ+clientsLen; j++ { indexJ := j % clientsLen if cl, err = p.innerPools[indexI].clients[indexJ].serviceClient(); err == nil { diff --git a/pool/tree/pool_test.go b/pool/tree/pool_test.go index 8c8a0cf..1c73205 100644 --- a/pool/tree/pool_test.go +++ b/pool/tree/pool_test.go @@ -3,10 +3,10 @@ package tree import ( "context" "errors" - grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" "testing" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" + grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -148,6 +148,14 @@ func TestRetry(t *testing.T) { require.NoError(t, err) checkIndicesAndReset(t, p, 1, 0) }) + + t.Run("no panic group switch", func(t *testing.T) { + setErrors(p, nodes[1]...) + p.setStartIndices(1, 0) + err := p.requestWithRetry(makeFn) + require.NoError(t, err) + checkIndicesAndReset(t, p, 0, 0) + }) } func TestRebalance(t *testing.T) { @@ -246,8 +254,7 @@ func checkIndicesAndReset(t *testing.T, p *Pool, iExp, jExp int) { func checkIndices(t *testing.T, p *Pool, iExp, jExp int) { i, j := p.getStartIndices() - require.Equal(t, iExp, i) - require.Equal(t, jExp, j) + require.Equal(t, [2]int{iExp, jExp}, [2]int{i, j}) } func resetClients(p *Pool) { From 66cb5dcf34e97dcab0267d59ca6dba6f3b670f77 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 6 Jun 2023 10:48:42 +0300 Subject: [PATCH 032/323] [#83] Update .gitignore Signed-off-by: Anton Nikiforov --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b4fc404..701012c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,7 @@ coverage.txt coverage.html # antlr tool jar -antlr-*.jar \ No newline at end of file +antlr-*.jar + +# tempfiles +.cache From 2f884601726cbd9aaba1b10a8b225a1e64ce7c2d Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 27 Jun 2023 11:53:53 +0300 Subject: [PATCH 033/323] [#83] Allow to split objects in the client Signed-off-by: Anton Nikiforov --- client/object_put.go | 225 ++++++++----------------------- client/object_put_raw.go | 154 +++++++++++++++++++++ client/object_put_transformer.go | 88 ++++++++++++ pool/pool.go | 6 +- 4 files changed, 298 insertions(+), 175 deletions(-) create mode 100644 client/object_put_raw.go create mode 100644 client/object_put_transformer.go diff --git a/client/object_put.go b/client/object_put.go index d56a6fc..2861ea4 100644 --- a/client/object_put.go +++ b/client/object_put.go @@ -3,29 +3,29 @@ package client import ( "context" "crypto/ecdsa" - "errors" - "fmt" - "io" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" - apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" ) +// defaultGRPCPayloadChunkLen default value for maxChunkLen. +// See PrmObjectPutInit.SetGRPCPayloadChunkLen for details. +const defaultGRPCPayloadChunkLen = 3 << 20 + // PrmObjectPutInit groups parameters of ObjectPutInit operation. type PrmObjectPutInit struct { - copyNum []uint32 - key *ecdsa.PrivateKey - meta v2session.RequestMetaHeader - maxChunkLen int + copyNum []uint32 + key *ecdsa.PrivateKey + meta v2session.RequestMetaHeader + maxChunkLen int + maxSize uint64 + epochSource transformer.EpochSource + withoutHomomorphicHash bool } // SetCopiesNumber sets number of object copies that is enough to consider put successful. @@ -61,31 +61,35 @@ func (x ResObjectPut) StoredObjectID() oid.ID { return x.obj } -// ObjectWriter is designed to write one object to FrostFS system. +// ObjectWriter is designed to write one object or +// multiple parts of one object to FrostFS system. // // Must be initialized using Client.ObjectPutInit, any other // usage is unsafe. -type ObjectWriter struct { - cancelCtxStream context.CancelFunc - - client *Client - stream interface { - Write(*v2object.PutRequest) error - Close() error - } - - key *ecdsa.PrivateKey - res ResObjectPut - err error - - chunkCalled bool - - respV2 v2object.PutResponse - req v2object.PutRequest - partInit v2object.PutObjectPartInit - partChunk v2object.PutObjectPartChunk - - maxChunkLen int +type ObjectWriter interface { + // WriteHeader writes header of the object. Result means success. + // Failure reason can be received via Close. + WriteHeader(context.Context, object.Object) bool + // WritePayloadChunk writes chunk of the object payload. Result means success. + // Failure reason can be received via Close. + WritePayloadChunk(context.Context, []byte) bool + // Close ends writing the object and returns the result of the operation + // along with the final results. Must be called after using the ObjectWriter. + // + // Exactly one return value is non-nil. By default, server status is returned in res structure. + // Any client's internal or transport errors are returned as Go built-in error. + // If Client is tuned to resolve FrostFS API statuses, then FrostFS failures + // codes are returned as error. + // + // Return statuses: + // - global (see Client docs); + // - *apistatus.ContainerNotFound; + // - *apistatus.ObjectAccessDenied; + // - *apistatus.ObjectLocked; + // - *apistatus.LockNonRegularObject; + // - *apistatus.SessionTokenNotFound; + // - *apistatus.SessionTokenExpired. + Close(context.Context) (*ResObjectPut, error) } // UseKey specifies private key to sign the requests. @@ -124,122 +128,21 @@ func (x *PrmObjectPutInit) WithXHeaders(hs ...string) { writeXHeadersToMeta(hs, &x.meta) } -// WriteHeader writes header of the object. Result means success. -// Failure reason can be received via Close. -func (x *ObjectWriter) WriteHeader(hdr object.Object) bool { - v2Hdr := hdr.ToV2() - - x.partInit.SetObjectID(v2Hdr.GetObjectID()) - x.partInit.SetHeader(v2Hdr.GetHeader()) - x.partInit.SetSignature(v2Hdr.GetSignature()) - - x.req.GetBody().SetObjectPart(&x.partInit) - x.req.SetVerificationHeader(nil) - - x.err = signature.SignServiceMessage(x.key, &x.req) - if x.err != nil { - x.err = fmt.Errorf("sign message: %w", x.err) - return false - } - - x.err = x.stream.Write(&x.req) - return x.err == nil +// WithObjectMaxSize specifies max object size value and use it during object splitting. +// When specified, start writing to the stream only after the object is formed. +// Continue processing the input only when the previous formed object has been successfully written. +func (x *PrmObjectPutInit) WithObjectMaxSize(maxSize uint64) { + x.maxSize = maxSize } -// WritePayloadChunk writes chunk of the object payload. Result means success. -// Failure reason can be received via Close. -func (x *ObjectWriter) WritePayloadChunk(chunk []byte) bool { - if !x.chunkCalled { - x.chunkCalled = true - x.req.GetBody().SetObjectPart(&x.partChunk) - } - - for ln := len(chunk); ln > 0; ln = len(chunk) { - if ln > x.maxChunkLen { - ln = x.maxChunkLen - } - - // we deal with size limit overflow above, but there is another case: - // what if method is called with "small" chunk many times? We write - // a message to the stream on each call. Alternatively, we could use buffering. - // In most cases, the chunk length does not vary between calls. Given this - // assumption, as well as the length of the payload from the header, it is - // possible to buffer the data of intermediate chunks, and send a message when - // the allocated buffer is filled, or when the last chunk is received. - // It is mentally assumed that allocating and filling the buffer is better than - // synchronous sending, but this needs to be tested. - x.partChunk.SetChunk(chunk[:ln]) - x.req.SetVerificationHeader(nil) - - x.err = signature.SignServiceMessage(x.key, &x.req) - if x.err != nil { - x.err = fmt.Errorf("sign message: %w", x.err) - return false - } - - x.err = x.stream.Write(&x.req) - if x.err != nil { - return false - } - - chunk = chunk[ln:] - } - - return true +// WithoutHomomorphicHash if set to true do not use Tillich-Zémor hash for payload. +func (x *PrmObjectPutInit) WithoutHomomorphicHash(v bool) { + x.withoutHomomorphicHash = v } -// Close ends writing the object and returns the result of the operation -// along with the final results. Must be called after using the ObjectWriter. -// -// Exactly one return value is non-nil. By default, server status is returned in res structure. -// Any client's internal or transport errors are returned as Go built-in error. -// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures -// codes are returned as error. -// -// Return statuses: -// - global (see Client docs); -// - *apistatus.ContainerNotFound; -// - *apistatus.ObjectAccessDenied; -// - *apistatus.ObjectLocked; -// - *apistatus.LockNonRegularObject; -// - *apistatus.SessionTokenNotFound; -// - *apistatus.SessionTokenExpired. -func (x *ObjectWriter) Close() (*ResObjectPut, error) { - defer x.cancelCtxStream() - - // Ignore io.EOF error, because it is expected error for client-side - // stream termination by the server. E.g. when stream contains invalid - // message. Server returns an error in response message (in status). - if x.err != nil && !errors.Is(x.err, io.EOF) { - return nil, x.err - } - - if x.err = x.stream.Close(); x.err != nil { - return nil, x.err - } - - x.res.st, x.err = x.client.processResponse(&x.respV2) - if x.err != nil { - return nil, x.err - } - - if !apistatus.IsSuccessful(x.res.st) { - return &x.res, nil - } - - const fieldID = "ID" - - idV2 := x.respV2.GetBody().GetObjectID() - if idV2 == nil { - return nil, newErrMissingResponseField(fieldID) - } - - x.err = x.res.obj.ReadFromV2(*idV2) - if x.err != nil { - x.err = newErrInvalidResponseField(fieldID, x.err) - } - - return &x.res, nil +// WithEpochSource specifies epoch for object when split it on client side. +func (x *PrmObjectPutInit) WithEpochSource(es transformer.EpochSource) { + x.epochSource = es } // ObjectPutInit initiates writing an object through a remote server using FrostFS API protocol. @@ -249,31 +152,9 @@ func (x *ObjectWriter) Close() (*ResObjectPut, error) { // // Returns an error if parameters are set incorrectly. // Context is required and must not be nil. It is used for network communication. -func (c *Client) ObjectPutInit(ctx context.Context, prm PrmObjectPutInit) (*ObjectWriter, error) { - var w ObjectWriter - - ctx, cancel := context.WithCancel(ctx) - stream, err := rpcapi.PutObject(&c.c, &w.respV2, client.WithContext(ctx)) - if err != nil { - cancel() - return nil, fmt.Errorf("open stream: %w", err) +func (c *Client) ObjectPutInit(ctx context.Context, prm PrmObjectPutInit) (ObjectWriter, error) { + if prm.maxSize > 0 { + return c.objectPutInitTransformer(prm) } - - w.key = &c.prm.key - if prm.key != nil { - w.key = prm.key - } - w.cancelCtxStream = cancel - w.client = c - w.stream = stream - w.partInit.SetCopiesNumber(prm.copyNum) - w.req.SetBody(new(v2object.PutRequestBody)) - if prm.maxChunkLen > 0 { - w.maxChunkLen = prm.maxChunkLen - } else { - w.maxChunkLen = 3 << 20 - } - c.prepareRequest(&w.req, &prm.meta) - - return &w, nil + return c.objectPutInitRaw(ctx, prm) } diff --git a/client/object_put_raw.go b/client/object_put_raw.go new file mode 100644 index 0000000..64cb250 --- /dev/null +++ b/client/object_put_raw.go @@ -0,0 +1,154 @@ +package client + +import ( + "context" + "crypto/ecdsa" + "errors" + "fmt" + "io" + + v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" +) + +func (c *Client) objectPutInitRaw(ctx context.Context, prm PrmObjectPutInit) (*objectWriterRaw, error) { + var w objectWriterRaw + stream, err := rpcapi.PutObject(&c.c, &w.respV2, client.WithContext(ctx)) + if err != nil { + return nil, fmt.Errorf("open stream: %w", err) + } + + w.key = &c.prm.key + if prm.key != nil { + w.key = prm.key + } + w.client = c + w.stream = stream + w.partInit.SetCopiesNumber(prm.copyNum) + w.req.SetBody(new(v2object.PutRequestBody)) + if prm.maxChunkLen > 0 { + w.maxChunkLen = prm.maxChunkLen + } else { + w.maxChunkLen = defaultGRPCPayloadChunkLen + } + c.prepareRequest(&w.req, &prm.meta) + return &w, nil +} + +type objectWriterRaw struct { + client *Client + stream interface { + Write(*v2object.PutRequest) error + Close() error + } + + key *ecdsa.PrivateKey + res ResObjectPut + err error + chunkCalled bool + respV2 v2object.PutResponse + req v2object.PutRequest + partInit v2object.PutObjectPartInit + partChunk v2object.PutObjectPartChunk + maxChunkLen int +} + +func (x *objectWriterRaw) WriteHeader(_ context.Context, hdr object.Object) bool { + v2Hdr := hdr.ToV2() + + x.partInit.SetObjectID(v2Hdr.GetObjectID()) + x.partInit.SetHeader(v2Hdr.GetHeader()) + x.partInit.SetSignature(v2Hdr.GetSignature()) + + x.req.GetBody().SetObjectPart(&x.partInit) + x.req.SetVerificationHeader(nil) + + x.err = signature.SignServiceMessage(x.key, &x.req) + if x.err != nil { + x.err = fmt.Errorf("sign message: %w", x.err) + return false + } + + x.err = x.stream.Write(&x.req) + return x.err == nil +} + +func (x *objectWriterRaw) WritePayloadChunk(_ context.Context, chunk []byte) bool { + if !x.chunkCalled { + x.chunkCalled = true + x.req.GetBody().SetObjectPart(&x.partChunk) + } + + for ln := len(chunk); ln > 0; ln = len(chunk) { + if ln > x.maxChunkLen { + ln = x.maxChunkLen + } + + // we deal with size limit overflow above, but there is another case: + // what if method is called with "small" chunk many times? We write + // a message to the stream on each call. Alternatively, we could use buffering. + // In most cases, the chunk length does not vary between calls. Given this + // assumption, as well as the length of the payload from the header, it is + // possible to buffer the data of intermediate chunks, and send a message when + // the allocated buffer is filled, or when the last chunk is received. + // It is mentally assumed that allocating and filling the buffer is better than + // synchronous sending, but this needs to be tested. + x.partChunk.SetChunk(chunk[:ln]) + x.req.SetVerificationHeader(nil) + + x.err = signature.SignServiceMessage(x.key, &x.req) + if x.err != nil { + x.err = fmt.Errorf("sign message: %w", x.err) + return false + } + + x.err = x.stream.Write(&x.req) + if x.err != nil { + return false + } + + chunk = chunk[ln:] + } + + return true +} + +func (x *objectWriterRaw) Close(_ context.Context) (*ResObjectPut, error) { + // Ignore io.EOF error, because it is expected error for client-side + // stream termination by the server. E.g. when stream contains invalid + // message. Server returns an error in response message (in status). + if x.err != nil && !errors.Is(x.err, io.EOF) { + return nil, x.err + } + + if x.err = x.stream.Close(); x.err != nil { + return nil, x.err + } + + x.res.st, x.err = x.client.processResponse(&x.respV2) + if x.err != nil { + return nil, x.err + } + + if !apistatus.IsSuccessful(x.res.st) { + return &x.res, nil + } + + const fieldID = "ID" + + idV2 := x.respV2.GetBody().GetObjectID() + if idV2 == nil { + return nil, newErrMissingResponseField(fieldID) + } + + x.err = x.res.obj.ReadFromV2(*idV2) + if x.err != nil { + x.err = newErrInvalidResponseField(fieldID, x.err) + } + + return &x.res, nil +} diff --git a/client/object_put_transformer.go b/client/object_put_transformer.go new file mode 100644 index 0000000..636e56b --- /dev/null +++ b/client/object_put_transformer.go @@ -0,0 +1,88 @@ +package client + +import ( + "context" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" +) + +func (c *Client) objectPutInitTransformer(prm PrmObjectPutInit) (*objectWriterTransformer, error) { + var w objectWriterTransformer + w.it = internalTarget{ + client: c, + prm: prm, + } + key := &c.prm.key + if prm.key != nil { + key = prm.key + } + w.ot = transformer.NewPayloadSizeLimiter(transformer.Params{ + Key: key, + NextTargetInit: func() transformer.ObjectTarget { return &w.it }, + MaxSize: prm.maxSize, + WithoutHomomorphicHash: prm.withoutHomomorphicHash, + NetworkState: prm.epochSource, + }) + return &w, nil +} + +type objectWriterTransformer struct { + ot transformer.ObjectTarget + it internalTarget + err error +} + +func (x *objectWriterTransformer) WriteHeader(ctx context.Context, hdr object.Object) bool { + x.err = x.ot.WriteHeader(ctx, &hdr) + return x.err == nil +} + +func (x *objectWriterTransformer) WritePayloadChunk(ctx context.Context, chunk []byte) bool { + _, x.err = x.ot.Write(ctx, chunk) + return x.err == nil +} + +func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, error) { + if ai, err := x.ot.Close(ctx); err != nil { + return nil, err + } else { + if ai != nil && ai.ParentID != nil { + x.it.res.obj = *ai.ParentID + } + return x.it.res, nil + } +} + +type internalTarget struct { + current *object.Object + client *Client + res *ResObjectPut + prm PrmObjectPutInit + payload []byte +} + +func (it *internalTarget) WriteHeader(_ context.Context, object *object.Object) error { + it.current = object + return nil +} + +func (it *internalTarget) Write(_ context.Context, p []byte) (n int, err error) { + it.payload = append(it.payload, p...) + return len(p), nil +} + +func (it *internalTarget) Close(ctx context.Context) (*transformer.AccessIdentifiers, error) { + it.current.SetPayload(it.payload) + wrt, err := it.client.objectPutInitRaw(ctx, it.prm) + if err != nil { + return nil, err + } + if wrt.WriteHeader(ctx, *it.current) { + wrt.WritePayloadChunk(ctx, it.current.Payload()) + } + it.res, err = wrt.Close(ctx) + it.current = nil + it.payload = nil + return nil, err +} diff --git a/pool/pool.go b/pool/pool.go index b56c574..2f662d3 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -645,7 +645,7 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID return oid.ID{}, fmt.Errorf("init writing on API client: %w", err) } - if wObj.WriteHeader(prm.hdr) { + if wObj.WriteHeader(ctx, prm.hdr) { sz := prm.hdr.PayloadSize() if data := prm.hdr.Payload(); len(data) > 0 { @@ -672,7 +672,7 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID n, err = prm.payload.Read(buf) if n > 0 { start = time.Now() - successWrite := wObj.WritePayloadChunk(buf[:n]) + successWrite := wObj.WritePayloadChunk(ctx, buf[:n]) c.incRequests(time.Since(start), methodObjectPut) if !successWrite { break @@ -690,7 +690,7 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID } } - res, err := wObj.Close() + res, err := wObj.Close(ctx) var st apistatus.Status if res != nil { st = res.Status() From c0c0c588b5e609c6c5ea8f69dc5a933402a52556 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 27 Jun 2023 17:39:33 +0300 Subject: [PATCH 034/323] [#98] Add forgejo workflows Signed-off-by: Alex Vanin --- .forgejo/workflows/dco.yml | 20 ++++++++++++++ .forgejo/workflows/tests.yml | 31 +++++++++++++++++++++ .github/workflows/dco.yml | 21 --------------- .github/workflows/tests.yml | 52 ------------------------------------ 4 files changed, 51 insertions(+), 73 deletions(-) create mode 100644 .forgejo/workflows/dco.yml create mode 100644 .forgejo/workflows/tests.yml delete mode 100644 .github/workflows/dco.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml new file mode 100644 index 0000000..682855b --- /dev/null +++ b/.forgejo/workflows/dco.yml @@ -0,0 +1,20 @@ +on: [pull_request] + +jobs: + dco: + name: DCO + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + + - name: Run commit format checker + uses: https://git.alexvan.in/alexvanin/dco-go@v1 + with: + from: 406c2324 diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml new file mode 100644 index 0000000..e457cba --- /dev/null +++ b/.forgejo/workflows/tests.yml @@ -0,0 +1,31 @@ +on: [pull_request] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: https://github.com/golangci/golangci-lint-action@v2 + with: + version: latest + + tests: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.19', '1.20' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Run tests + run: make test diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml deleted file mode 100644 index 40ed8fc..0000000 --- a/.github/workflows/dco.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: DCO check - -on: - pull_request: - branches: - - master - -jobs: - commits_check_job: - runs-on: ubuntu-latest - name: Commits Check - steps: - - name: Get PR Commits - id: 'get-pr-commits' - uses: tim-actions/get-pr-commits@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: DCO Check - uses: tim-actions/dco@master - with: - commits: ${{ steps.get-pr-commits.outputs.commits }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 0b7de71..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: neofs-sdk-go tests - -on: - pull_request: - branches: - - master - types: [opened, synchronize] - paths-ignore: - - '**/*.md' - workflow_dispatch: - -jobs: - tests: - name: Tests - runs-on: ubuntu-20.04 - strategy: - matrix: - go_versions: [ '1.18.x', '1.19.x', '1.20.x' ] - fail-fast: false - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '${{ matrix.go_versions }}' - - - name: Restore Go modules from cache - uses: actions/cache@v3 - with: - path: /home/runner/go/pkg/mod - key: deps-${{ hashFiles('go.sum') }} - - - name: Update Go modules - run: make dep - - - name: Run tests - run: make test - - lint: - runs-on: ubuntu-20.04 - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: latest - only-new-issues: true From 5d62cef27e6c7d42c97ba1575658b97082da4f97 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 27 Jun 2023 17:47:07 +0300 Subject: [PATCH 035/323] [#98] Fix linter issues Signed-off-by: Alex Vanin --- netmap/netmap.go | 1 - netmap/policy.go | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/netmap/netmap.go b/netmap/netmap.go index c9969b6..7da41a8 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -234,7 +234,6 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e } result[i] = append(result[i], flattenNodes(nodes)...) } - } return result, nil diff --git a/netmap/policy.go b/netmap/policy.go index a03d36e..06e1cba 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -374,6 +374,7 @@ func (p *PlacementPolicy) AddFilters(fs ...Filter) { // the result into w. Returns w's errors directly. // // See also DecodeString. +// nolint: funlen func (p PlacementPolicy) WriteStringTo(w io.StringWriter) (err error) { if p.unique { if _, err := w.WriteString("UNIQUE\n"); err != nil { From 769f6eec0565e4dc3c6b966ed730217739f44ef3 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 5 Jul 2023 15:50:33 +0300 Subject: [PATCH 036/323] [#105] client: Fix revive linter warning Signed-off-by: Evgenii Stratonikov --- client/object_put_transformer.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/object_put_transformer.go b/client/object_put_transformer.go index 636e56b..b010deb 100644 --- a/client/object_put_transformer.go +++ b/client/object_put_transformer.go @@ -44,14 +44,15 @@ func (x *objectWriterTransformer) WritePayloadChunk(ctx context.Context, chunk [ } func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, error) { - if ai, err := x.ot.Close(ctx); err != nil { + ai, err := x.ot.Close(ctx) + if err != nil { return nil, err - } else { - if ai != nil && ai.ParentID != nil { - x.it.res.obj = *ai.ParentID - } - return x.it.res, nil } + + if ai != nil && ai.ParentID != nil { + x.it.res.obj = *ai.ParentID + } + return x.it.res, nil } type internalTarget struct { From 37e22b33ad40e19a20743d278ba586c9e50d8b70 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 4 Jul 2023 17:05:50 +0300 Subject: [PATCH 037/323] [#103] sdk-go: Update api-go version Signed-off-by: Dmitrii Stepanov --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 89f6fe3..bdb3df5 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.19 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 diff --git a/go.sum b/go.sum index a409e2f..bd0d791 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac h1:a6/Zc5BejflmguShwbllgJdEehnM9gshkLrLbKQHCU0= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe h1:SB102RiEg+4h9qcwyG97zHBtwduMRbedbtkwRDVSps8= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= From 98cab7ed61663452b1f9abfca22cd746539f3fe6 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 6 Jul 2023 17:06:17 +0300 Subject: [PATCH 038/323] [#103] object: Add PutSingle method code Signed-off-by: Dmitrii Stepanov --- client/object_put_single.go | 116 +++++++++++++++++++++++++++++++ client/object_put_transformer.go | 54 ++++++++++++-- 2 files changed, 163 insertions(+), 7 deletions(-) create mode 100644 client/object_put_single.go diff --git a/client/object_put_single.go b/client/object_put_single.go new file mode 100644 index 0000000..4ed03a6 --- /dev/null +++ b/client/object_put_single.go @@ -0,0 +1,116 @@ +package client + +import ( + "context" + "crypto/ecdsa" + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" +) + +// PrmObjectPutSingle groups parameters of PutSingle operation. +type PrmObjectPutSingle struct { + copyNum []uint32 + meta v2session.RequestMetaHeader + object *v2object.Object + key *ecdsa.PrivateKey +} + +// SetCopiesNumber sets ordered list of minimal required object copies numbers +// per placement vector. List's length MUST equal container's placement vector number, +// otherwise request will fail. +func (x *PrmObjectPutSingle) SetCopiesNumber(v []uint32) { + x.copyNum = v +} + +// UseKey specifies private key to sign the requests. +// If key is not provided, then Client default key is used. +func (x *PrmObjectPutSingle) UseKey(key *ecdsa.PrivateKey) { + x.key = key +} + +// WithBearerToken attaches bearer token to be used for the operation. +// Should be called once before any writing steps. +func (x *PrmObjectPutSingle) WithBearerToken(t bearer.Token) { + v2token := &acl.BearerToken{} + t.WriteToV2(v2token) + x.meta.SetBearerToken(v2token) +} + +// WithinSession specifies session within which object should be stored. +// Should be called once before any writing steps. +func (x *PrmObjectPutSingle) WithinSession(t session.Object) { + tv2 := &v2session.Token{} + t.WriteToV2(tv2) + x.meta.SetSessionToken(tv2) +} + +// ExecuteLocal tells the server to execute the operation locally. +func (x *PrmObjectPutSingle) ExecuteLocal() { + x.meta.SetTTL(1) +} + +// WithXHeaders specifies list of extended headers (string key-value pairs) +// to be attached to the request. Must have an even length. +// +// Slice must not be mutated until the operation completes. +func (x *PrmObjectPutSingle) WithXHeaders(hs ...string) { + writeXHeadersToMeta(hs, &x.meta) +} + +// SetObject specifies prepared object to put. +func (x *PrmObjectPutSingle) SetObject(o *v2object.Object) { + x.object = o +} + +// ResObjectPutSingle groups resulting values of PutSingle operation. +type ResObjectPutSingle struct { + statusRes +} + +// ObjectPutSingle writes prepared object to FrostFS. +// Object must have payload, also containerID, objectID, ownerID, payload hash, payload length of an object must be set. +// Exactly one return value is non-nil. By default, server status is returned in res structure. +// Any client's internal or transport errors are returned as Go built-in error. +// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures +// codes are returned as error. +func (c *Client) ObjectPutSingle(ctx context.Context, prm PrmObjectPutSingle) (*ResObjectPutSingle, error) { + body := &v2object.PutSingleRequestBody{} + body.SetCopiesNumber(prm.copyNum) + body.SetObject(prm.object) + + req := &v2object.PutSingleRequest{} + req.SetBody(body) + + c.prepareRequest(req, &prm.meta) + + key := &c.prm.key + if prm.key != nil { + key = prm.key + } + + err := signature.SignServiceMessage(key, req) + if err != nil { + return nil, fmt.Errorf("sign request: %w", err) + } + + resp, err := rpcapi.PutSingleObject(&c.c, req, client.WithContext(ctx)) + if err != nil { + return nil, err + } + + var res ResObjectPutSingle + res.st, err = c.processResponse(resp) + if err != nil { + return nil, err + } + + return &res, nil +} diff --git a/client/object_put_transformer.go b/client/object_put_transformer.go index b010deb..cb44f61 100644 --- a/client/object_put_transformer.go +++ b/client/object_put_transformer.go @@ -5,6 +5,8 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func (c *Client) objectPutInitTransformer(prm PrmObjectPutInit) (*objectWriterTransformer, error) { @@ -56,11 +58,12 @@ func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, err } type internalTarget struct { - current *object.Object - client *Client - res *ResObjectPut - prm PrmObjectPutInit - payload []byte + current *object.Object + client *Client + res *ResObjectPut + prm PrmObjectPutInit + payload []byte + useStream bool } func (it *internalTarget) WriteHeader(_ context.Context, object *object.Object) error { @@ -75,9 +78,19 @@ func (it *internalTarget) Write(_ context.Context, p []byte) (n int, err error) func (it *internalTarget) Close(ctx context.Context) (*transformer.AccessIdentifiers, error) { it.current.SetPayload(it.payload) + + putSingleImplemented, err := it.tryPutSingle(ctx) + if putSingleImplemented { + return nil, err + } + it.useStream = true + return nil, it.putAsStream(ctx) +} + +func (it *internalTarget) putAsStream(ctx context.Context) error { wrt, err := it.client.objectPutInitRaw(ctx, it.prm) if err != nil { - return nil, err + return err } if wrt.WriteHeader(ctx, *it.current) { wrt.WritePayloadChunk(ctx, it.current.Payload()) @@ -85,5 +98,32 @@ func (it *internalTarget) Close(ctx context.Context) (*transformer.AccessIdentif it.res, err = wrt.Close(ctx) it.current = nil it.payload = nil - return nil, err + return err +} + +func (it *internalTarget) tryPutSingle(ctx context.Context) (bool, error) { + if it.useStream { + return false, nil + } + var prm PrmObjectPutSingle + prm.SetCopiesNumber(it.prm.copyNum) + prm.SetObject(it.current.ToV2()) + prm.UseKey(prm.key) + prm.meta = it.prm.meta + + res, err := it.client.ObjectPutSingle(ctx, prm) + if err != nil && status.Code(err) == codes.Unimplemented { + return false, err + } + + if err == nil { + id, _ := it.current.ID() + it.res = &ResObjectPut{ + statusRes: res.statusRes, + obj: id, + } + } + it.current = nil + it.payload = nil + return true, err } From fe28c332772c0e2eaefaed3b251457ba9071fed1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 5 Jul 2023 14:25:24 +0300 Subject: [PATCH 039/323] [#104] netmap: Add test with quote escaping Signed-off-by: Alex Vanin --- netmap/policy_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netmap/policy_test.go b/netmap/policy_test.go index 75167dc..98ce5f2 100644 --- a/netmap/policy_test.go +++ b/netmap/policy_test.go @@ -31,6 +31,10 @@ FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS `UNIQUE REP 1 REP 1`, + + `REP 1 IN X +SELECT 1 FROM F AS X +FILTER 'UN-LOCODE' EQ 'RU LED' AS F`, } var p PlacementPolicy From 14ed3e177dc260199022d6e69f7cfa179dc6880b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 5 Jul 2023 14:25:18 +0300 Subject: [PATCH 040/323] [#104] nemtap: Escape special symbols in filters Signed-off-by: Alex Vanin --- netmap/policy.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/netmap/policy.go b/netmap/policy.go index 06e1cba..323050e 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -471,7 +471,7 @@ func writeFilterStringTo(w io.StringWriter, f netmap.Filter) error { unspecified := op == 0 if s = f.GetKey(); s != "" { - _, err = w.WriteString(fmt.Sprintf("%s %s %s", s, op, f.GetValue())) + _, err = w.WriteString(fmt.Sprintf("%s %s %s", escapeString(s), op, escapeString(f.GetValue()))) if err != nil { return err } @@ -816,3 +816,12 @@ func operationFromString(s string) (op netmap.Operation) { return } + +// escapeString returns single quote wrapped string if it contains special +// characters '-' and whitespace. +func escapeString(s string) string { + if strings.ContainsAny(s, " -\t") { + return "'" + s + "'" + } + return s +} From 388d1ca1de0cd37a874147b81a4ee79dc68c1c81 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 7 Jul 2023 12:57:53 +0300 Subject: [PATCH 041/323] [#107] pool/tree: Support grpc schemas Signed-off-by: Denis Kirillov --- pool/tree/client.go | 41 ++++++++++++++++++++++++++++++++--------- pool/tree/pool.go | 2 +- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/pool/tree/client.go b/pool/tree/client.go index 60377db..326a8cc 100644 --- a/pool/tree/client.go +++ b/pool/tree/client.go @@ -2,11 +2,15 @@ package tree import ( "context" + "crypto/tls" "fmt" "sync" + apiClient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) type treeClient struct { @@ -35,12 +39,10 @@ func (c *treeClient) dial(ctx context.Context) error { } var err error - c.conn, err = grpc.DialContext(ctx, c.address, c.opts...) - if err != nil { - return fmt.Errorf("grpc dial node tree service: %w", err) + if c.conn, c.service, err = dialClient(ctx, c.address, c.opts...); err != nil { + return err } - c.service = grpcService.NewTreeServiceClient(c.conn) if _, err = c.service.Healthcheck(ctx, &grpcService.HealthcheckRequest{}); err != nil { return fmt.Errorf("healthcheck tree service: %w", err) } @@ -55,12 +57,9 @@ func (c *treeClient) redialIfNecessary(ctx context.Context) (healthHasChanged bo defer c.mu.Unlock() if c.conn == nil { - c.conn, err = grpc.DialContext(ctx, c.address, c.opts...) - if err != nil { - return false, fmt.Errorf("grpc dial node tree service: %w", err) + if c.conn, c.service, err = dialClient(ctx, c.address, c.opts...); err != nil { + return false, err } - - c.service = grpcService.NewTreeServiceClient(c.conn) } wasHealthy := c.healthy @@ -74,6 +73,30 @@ func (c *treeClient) redialIfNecessary(ctx context.Context) (healthHasChanged bo return !wasHealthy, nil } +func dialClient(ctx context.Context, addr string, clientOptions ...grpc.DialOption) (*grpc.ClientConn, grpcService.TreeServiceClient, error) { + host, tlsEnable, err := apiClient.ParseURI(addr) + if err != nil { + return nil, nil, fmt.Errorf("parse address: %w", err) + } + + creds := insecure.NewCredentials() + if tlsEnable { + creds = credentials.NewTLS(&tls.Config{}) + } + + options := []grpc.DialOption{grpc.WithTransportCredentials(creds)} + + // the order is matter, we want client to be able to overwrite options. + opts := append(options, clientOptions...) + + conn, err := grpc.DialContext(ctx, host, opts...) + if err != nil { + return nil, nil, fmt.Errorf("grpc dial node tree service: %w", err) + } + + return conn, grpcService.NewTreeServiceClient(conn), nil +} + func (c *treeClient) serviceClient() (grpcService.TreeServiceClient, error) { c.mu.RLock() defer c.mu.RUnlock() diff --git a/pool/tree/pool.go b/pool/tree/pool.go index ff155dc..7fca21b 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -196,7 +196,7 @@ func (p *Pool) Dial(ctx context.Context) error { for j, node := range nodes { clients[j] = newTreeClient(node.Address(), p.dialOptions...) if err := clients[j].dial(ctx); err != nil { - p.log(zap.WarnLevel, "failed to build client", zap.String("address", node.Address()), zap.Error(err)) + p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", node.Address()), zap.Error(err)) continue } From fe35373d8f1b927a971fa3e4f27cd34a5e14dc6b Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 7 Jul 2023 12:58:24 +0300 Subject: [PATCH 042/323] [#107] go.mod: Tidy dependencies Signed-off-by: Denis Kirillov --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index bd0d791..d59bea8 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac h1:a6/Zc5BejflmguShwbllgJdEehnM9gshkLrLbKQHCU0= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe h1:SB102RiEg+4h9qcwyG97zHBtwduMRbedbtkwRDVSps8= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= From 35346a01c9352549cd90072bb179b725000d0938 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 Jul 2023 14:24:34 +0300 Subject: [PATCH 043/323] [#109] Bump neo-go version Synced version with frostfs-node, see frostfs-node#417 Signed-off-by: Alex Vanin --- go.mod | 6 +++--- go.sum | 11 ++++++----- ns/nns.go | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index bdb3df5..1148630 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/uuid v1.3.0 github.com/hashicorp/golang-lru/v2 v2.0.2 github.com/mr-tron/base58 v1.2.0 - github.com/nspcc-dev/neo-go v0.101.1 + github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc github.com/stretchr/testify v1.8.3 go.uber.org/zap v1.24.0 google.golang.org/grpc v1.55.0 @@ -28,11 +28,11 @@ require ( github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/golang-lru v0.6.0 // indirect github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect - github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb // indirect + github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a // indirect github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/twmb/murmur3 v1.1.8 // indirect - go.uber.org/atomic v1.9.0 // indirect + go.uber.org/atomic v1.10.0 // indirect go.uber.org/goleak v1.2.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.9.0 // indirect diff --git a/go.sum b/go.sum index d59bea8..3376954 100644 --- a/go.sum +++ b/go.sum @@ -268,11 +268,11 @@ github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkP github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM= github.com/nspcc-dev/neo-go v0.99.4/go.mod h1:mKTolfRUfKjFso5HPvGSQtUZc70n0VKBMs16eGuC5gA= -github.com/nspcc-dev/neo-go v0.101.1 h1:TVdcIpH/+bxQBTLRwWE3+Pw3j6j/JwguENbBSGAGid0= -github.com/nspcc-dev/neo-go v0.101.1/go.mod h1:J4tspxWw7jknX06F+VSMsKvIiNpYGfVTb2IxVC005YU= +github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc h1:fySIWvUQsitK5e5qYIHnTDCXuPpwzz89SEUEIyY11sg= +github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc/go.mod h1:s9QhjMC784MWqTURovMbyYduIJc86mnCruxcMiAebpc= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb h1:GFxfkpXEYAbMIr69JpKOsQWeLOaGrd49HNAor8uDW+A= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a h1:63sh46kfKF/g2IE1z/EV8CBEKCVmGJXSSH0ZHqTDGCY= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a/go.mod h1:ZUuXOkdtHZgaC13za/zMgXfQFncZ0jLzfQTe+OsDOtg= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= @@ -373,8 +373,9 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= diff --git a/ns/nns.go b/ns/nns.go index 3c40ab0..cb8dbd4 100644 --- a/ns/nns.go +++ b/ns/nns.go @@ -51,7 +51,7 @@ func (n *NNS) Dial(address string) error { uri, err := url.Parse(address) if err == nil && (uri.Scheme == "ws" || uri.Scheme == "wss") { - multiSchemeClient, err = rpcclient.NewWS(context.Background(), address, rpcclient.Options{}) + multiSchemeClient, err = rpcclient.NewWS(context.Background(), address, rpcclient.WSOptions{}) if err != nil { return fmt.Errorf("create Neo WebSocket client: %w", err) } From 863be6034f62b1e5459046736b4aaddb5e365276 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 Jul 2023 14:56:01 +0300 Subject: [PATCH 044/323] [#104] Update neo-go/pkg/interop version neo-go module uses broken commit of interop package. Signed-off-by: Alex Vanin --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1148630..fc96fa4 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/golang-lru v0.6.0 // indirect github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect - github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a // indirect + github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce // indirect github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/twmb/murmur3 v1.1.8 // indirect diff --git a/go.sum b/go.sum index 3376954..11f92d0 100644 --- a/go.sum +++ b/go.sum @@ -271,8 +271,8 @@ github.com/nspcc-dev/neo-go v0.99.4/go.mod h1:mKTolfRUfKjFso5HPvGSQtUZc70n0VKBMs github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc h1:fySIWvUQsitK5e5qYIHnTDCXuPpwzz89SEUEIyY11sg= github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc/go.mod h1:s9QhjMC784MWqTURovMbyYduIJc86mnCruxcMiAebpc= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a h1:63sh46kfKF/g2IE1z/EV8CBEKCVmGJXSSH0ZHqTDGCY= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a/go.mod h1:ZUuXOkdtHZgaC13za/zMgXfQFncZ0jLzfQTe+OsDOtg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce h1:vLGuUNDkmQrWMa4rr4vTd1u8ULqejWxVmNz1L7ocTEI= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce/go.mod h1:ZUuXOkdtHZgaC13za/zMgXfQFncZ0jLzfQTe+OsDOtg= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= From ac95b87e7c67c730edf34809646aca5a76b13eda Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Fri, 7 Jul 2023 08:47:30 +0300 Subject: [PATCH 045/323] [#101] Add `Equals` for `Address` Signed-off-by: Anton Nikiforov --- object/id/address.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/object/id/address.go b/object/id/address.go index 1f3a864..6d5f12a 100644 --- a/object/id/address.go +++ b/object/id/address.go @@ -169,3 +169,11 @@ func (x *Address) DecodeString(s string) error { func (x Address) String() string { return x.EncodeToString() } + +// Equals defines a comparison relation between two Address's instances. +// +// Note that comparison using '==' operator is not recommended since it MAY result +// in loss of compatibility. +func (x Address) Equals(other Address) bool { + return x.obj.Equals(other.obj) && x.cnr.Equals(other.cnr) +} From d70ef2187b5d1ac821b5b8036135d99ad9d365d5 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 6 Jul 2023 14:53:40 +0300 Subject: [PATCH 046/323] [#97] Add a method `IterateUserAttributes` in `Container` Signed-off-by: Anton Nikiforov --- container/container.go | 20 ++++++++++++++++++-- container/container_test.go | 8 +++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/container/container.go b/container/container.go index 7ecf143..9c6c0f8 100644 --- a/container/container.go +++ b/container/container.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "strconv" + "strings" "time" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" @@ -296,7 +297,7 @@ func (x Container) PlacementPolicy() (res netmap.PlacementPolicy) { // // SetAttribute overwrites existing attribute value. // -// See also Attribute, IterateAttributes. +// See also Attribute, IterateAttributes, IterateUserAttributes. func (x *Container) SetAttribute(key, value string) { if key == "" { panic("empty attribute key") @@ -324,7 +325,7 @@ func (x *Container) SetAttribute(key, value string) { // Attribute reads value of the Container attribute by key. Empty result means // attribute absence. // -// See also SetAttribute, IterateAttributes. +// See also SetAttribute, IterateAttributes, IterateUserAttributes. func (x Container) Attribute(key string) string { attrs := x.v2.GetAttributes() for i := range attrs { @@ -347,6 +348,21 @@ func (x Container) IterateAttributes(f func(key, val string)) { } } +// IterateUserAttributes iterates over user Container attributes and passes them +// into f. The handler MUST NOT be nil. +// +// See also SetAttribute, Attribute. +func (x Container) IterateUserAttributes(f func(key, val string)) { + attrs := x.v2.GetAttributes() + for _, attr := range attrs { + var key = attr.GetKey() + if !strings.HasPrefix(key, container.SysAttributePrefix) && + !strings.HasPrefix(key, container.SysAttributePrefixNeoFS) { + f(key, attr.GetValue()) + } + } +} + // SetName sets human-readable name of the Container. Name MUST NOT be empty. // // See also Name. diff --git a/container/container_test.go b/container/container_test.go index b3ab719..f0a2244 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -150,7 +150,7 @@ func assertContainsAttribute(t *testing.T, m v2container.Container, key, val str } func TestContainer_Attribute(t *testing.T) { - const attrKey1, attrKey2 = "key1", "key2" + const attrKey1, attrKey2 = v2container.SysAttributePrefix + "key1", v2container.SysAttributePrefixNeoFS + "key2" const attrVal1, attrVal2 = "val1", "val2" val := containertest.Container() @@ -158,6 +158,12 @@ func TestContainer_Attribute(t *testing.T) { val.SetAttribute(attrKey1, attrVal1) val.SetAttribute(attrKey2, attrVal2) + var i int + val.IterateUserAttributes(func(key, val string) { + i++ + }) + require.Equal(t, 1, i) + var msg v2container.Container val.WriteToV2(&msg) From c359a7465a7cc2674b07b7a4a6db8e90ccbdffd0 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 7 Jul 2023 15:34:31 +0300 Subject: [PATCH 047/323] [#64] transformer: Simplify interface Signed-off-by: Dmitrii Stepanov --- client/object_put_transformer.go | 42 ++++++++------------------ object/transformer/channel.go | 38 +++++------------------ object/transformer/channel_test.go | 4 +-- object/transformer/transformer.go | 26 +++++++--------- object/transformer/transformer_test.go | 39 +++++------------------- object/transformer/types.go | 15 ++++++--- 6 files changed, 52 insertions(+), 112 deletions(-) diff --git a/client/object_put_transformer.go b/client/object_put_transformer.go index cb44f61..ad8165d 100644 --- a/client/object_put_transformer.go +++ b/client/object_put_transformer.go @@ -21,7 +21,7 @@ func (c *Client) objectPutInitTransformer(prm PrmObjectPutInit) (*objectWriterTr } w.ot = transformer.NewPayloadSizeLimiter(transformer.Params{ Key: key, - NextTargetInit: func() transformer.ObjectTarget { return &w.it }, + NextTargetInit: func() transformer.ObjectWriter { return &w.it }, MaxSize: prm.maxSize, WithoutHomomorphicHash: prm.withoutHomomorphicHash, NetworkState: prm.epochSource, @@ -30,7 +30,7 @@ func (c *Client) objectPutInitTransformer(prm PrmObjectPutInit) (*objectWriterTr } type objectWriterTransformer struct { - ot transformer.ObjectTarget + ot transformer.ChunkedObjectWriter it internalTarget err error } @@ -58,56 +58,40 @@ func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, err } type internalTarget struct { - current *object.Object client *Client res *ResObjectPut prm PrmObjectPutInit - payload []byte useStream bool } -func (it *internalTarget) WriteHeader(_ context.Context, object *object.Object) error { - it.current = object - return nil -} - -func (it *internalTarget) Write(_ context.Context, p []byte) (n int, err error) { - it.payload = append(it.payload, p...) - return len(p), nil -} - -func (it *internalTarget) Close(ctx context.Context) (*transformer.AccessIdentifiers, error) { - it.current.SetPayload(it.payload) - - putSingleImplemented, err := it.tryPutSingle(ctx) +func (it *internalTarget) WriteObject(ctx context.Context, o *object.Object) error { + putSingleImplemented, err := it.tryPutSingle(ctx, o) if putSingleImplemented { - return nil, err + return err } it.useStream = true - return nil, it.putAsStream(ctx) + return it.putAsStream(ctx, o) } -func (it *internalTarget) putAsStream(ctx context.Context) error { +func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) error { wrt, err := it.client.objectPutInitRaw(ctx, it.prm) if err != nil { return err } - if wrt.WriteHeader(ctx, *it.current) { - wrt.WritePayloadChunk(ctx, it.current.Payload()) + if wrt.WriteHeader(ctx, *o) { + wrt.WritePayloadChunk(ctx, o.Payload()) } it.res, err = wrt.Close(ctx) - it.current = nil - it.payload = nil return err } -func (it *internalTarget) tryPutSingle(ctx context.Context) (bool, error) { +func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (bool, error) { if it.useStream { return false, nil } var prm PrmObjectPutSingle prm.SetCopiesNumber(it.prm.copyNum) - prm.SetObject(it.current.ToV2()) + prm.SetObject(o.ToV2()) prm.UseKey(prm.key) prm.meta = it.prm.meta @@ -117,13 +101,11 @@ func (it *internalTarget) tryPutSingle(ctx context.Context) (bool, error) { } if err == nil { - id, _ := it.current.ID() + id, _ := o.ID() it.res = &ResObjectPut{ statusRes: res.statusRes, obj: id, } } - it.current = nil - it.payload = nil return true, err } diff --git a/object/transformer/channel.go b/object/transformer/channel.go index b7a50a9..f6d94a5 100644 --- a/object/transformer/channel.go +++ b/object/transformer/channel.go @@ -4,47 +4,25 @@ import ( "context" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" - "github.com/nspcc-dev/neo-go/pkg/util/slice" ) type chanTarget struct { - header *objectSDK.Object - payload []byte - ch chan<- *objectSDK.Object + ch chan<- *objectSDK.Object } // NewChannelTarget returns ObjectTarget which writes // object parts to a provided channel. -func NewChannelTarget(ch chan<- *objectSDK.Object) ObjectTarget { +func NewChannelTarget(ch chan<- *objectSDK.Object) ObjectWriter { return &chanTarget{ ch: ch, } } -// WriteHeader implements the ObjectTarget interface. -func (c *chanTarget) WriteHeader(_ context.Context, object *objectSDK.Object) error { - c.header = object +func (c *chanTarget) WriteObject(ctx context.Context, o *objectSDK.Object) error { + select { + case c.ch <- o: + case <-ctx.Done(): + return ctx.Err() + } return nil } - -// Write implements the ObjectTarget interface. -func (c *chanTarget) Write(_ context.Context, p []byte) (n int, err error) { - c.payload = append(c.payload, p...) - return len(p), nil -} - -// Close implements the ObjectTarget interface. -func (c *chanTarget) Close(ctx context.Context) (*AccessIdentifiers, error) { - if len(c.payload) != 0 { - c.header.SetPayload(slice.Copy(c.payload)) - } - select { - case c.ch <- c.header: - case <-ctx.Done(): - return nil, ctx.Err() - } - - c.header = nil - c.payload = nil - return new(AccessIdentifiers), nil -} diff --git a/object/transformer/channel_test.go b/object/transformer/channel_test.go index 6b17bd5..1bb074b 100644 --- a/object/transformer/channel_test.go +++ b/object/transformer/channel_test.go @@ -18,8 +18,8 @@ func TestChannelTarget(t *testing.T) { tt := new(testTarget) ct := NewChannelTarget(ch) - chTarget, _ := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return ct }) - testTarget, _ := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return tt }) + chTarget, _ := newPayloadSizeLimiter(maxSize, func() ObjectWriter { return ct }) + testTarget, _ := newPayloadSizeLimiter(maxSize, func() ObjectWriter { return tt }) ver := version.Current() cnr := cidtest.ID() diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index a175662..6fea8dd 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -20,6 +20,7 @@ type payloadSizeLimiter struct { written, writtenCurrent uint64 current, parent *object.Object + payload []byte currentHashers, parentHashers []payloadChecksumHasher @@ -29,12 +30,12 @@ type payloadSizeLimiter struct { parAttrs []object.Attribute - nextTarget ObjectTarget + nextTarget ObjectWriter } type Params struct { Key *ecdsa.PrivateKey - NextTargetInit func() ObjectTarget + NextTargetInit TargetInitializer SessionToken *session.Object NetworkState EpochSource MaxSize uint64 @@ -48,7 +49,7 @@ type Params struct { // is false. // // Objects w/ payload size less or equal than max size remain untouched. -func NewPayloadSizeLimiter(p Params) ObjectTarget { +func NewPayloadSizeLimiter(p Params) ChunkedObjectWriter { return &payloadSizeLimiter{ Params: p, splitID: object.NewSplitID(), @@ -120,6 +121,7 @@ func (s *payloadSizeLimiter) initializeCurrent() { s.nextTarget = s.NextTargetInit() s.writtenCurrent = 0 s.initPayloadHashers() + s.payload = make([]byte, 0) } func (s *payloadSizeLimiter) initPayloadHashers() { @@ -160,12 +162,9 @@ func (s *payloadSizeLimiter) release(ctx context.Context, finalize bool) (*Acces return nil, fmt.Errorf("fillHeader: %w", err) } - if err := s.nextTarget.WriteHeader(ctx, s.current); err != nil { - return nil, fmt.Errorf("could not write header to next target: %w", err) - } - - if _, err := s.nextTarget.Close(ctx); err != nil { - return nil, fmt.Errorf("could not close next target: %w", err) + s.current.SetPayload(s.payload) + if err := s.nextTarget.WriteObject(ctx, s.current); err != nil { + return nil, fmt.Errorf("could not write to next target: %w", err) } // save identifier of the released object @@ -262,7 +261,7 @@ func (s *payloadSizeLimiter) writeChunk(ctx context.Context, chunk []byte) error cut = leftToEdge } - if err := s.writeHashes(ctx, chunk[:cut]); err != nil { + if err := s.writeHashes(chunk[:cut]); err != nil { return fmt.Errorf("could not write chunk to target: %w", err) } @@ -278,11 +277,8 @@ func (s *payloadSizeLimiter) writeChunk(ctx context.Context, chunk []byte) error } } -func (s *payloadSizeLimiter) writeHashes(ctx context.Context, chunk []byte) error { - _, err := s.nextTarget.Write(ctx, chunk) - if err != nil { - return err - } +func (s *payloadSizeLimiter) writeHashes(chunk []byte) error { + s.payload = append(s.payload, chunk...) // The `Write` method of `hash.Hash` never returns an error. for i := range s.currentHashers { diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index 11a6843..cbfb11a 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -20,7 +20,7 @@ func TestTransformer(t *testing.T) { tt := new(testTarget) - target, pk := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return tt }) + target, pk := newPayloadSizeLimiter(maxSize, func() ObjectWriter { return tt }) cnr := cidtest.ID() hdr := newObject(cnr) @@ -99,7 +99,7 @@ func newObject(cnr cid.ID) *objectSDK.Object { return hdr } -func writeObject(t *testing.T, ctx context.Context, target ObjectTarget, header *objectSDK.Object, payload []byte) *AccessIdentifiers { +func writeObject(t *testing.T, ctx context.Context, target ChunkedObjectWriter, header *objectSDK.Object, payload []byte) *AccessIdentifiers { require.NoError(t, target.WriteHeader(ctx, header)) _, err := target.Write(ctx, payload) @@ -131,7 +131,7 @@ func benchmarkTransformer(b *testing.B, header *objectSDK.Object, payloadSize in b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - f, _ := newPayloadSizeLimiter(maxSize, func() ObjectTarget { return benchTarget{} }) + f, _ := newPayloadSizeLimiter(maxSize, func() ObjectWriter { return benchTarget{} }) if err := f.WriteHeader(ctx, header); err != nil { b.Fatalf("write header: %v", err) } @@ -144,7 +144,7 @@ func benchmarkTransformer(b *testing.B, header *objectSDK.Object, payloadSize in } } -func newPayloadSizeLimiter(maxSize uint64, nextTarget func() ObjectTarget) (ObjectTarget, *keys.PrivateKey) { +func newPayloadSizeLimiter(maxSize uint64, nextTarget TargetInitializer) (ChunkedObjectWriter, *keys.PrivateKey) { p, err := keys.NewPrivateKey() if err != nil { panic(err) @@ -167,38 +167,15 @@ func (s dummyEpochSource) CurrentEpoch() uint64 { type benchTarget struct{} -func (benchTarget) WriteHeader(_ context.Context, object *objectSDK.Object) error { +func (benchTarget) WriteObject(context.Context, *objectSDK.Object) error { return nil } -func (benchTarget) Write(_ context.Context, p []byte) (n int, err error) { - return len(p), nil -} - -func (benchTarget) Close(context.Context) (*AccessIdentifiers, error) { - return nil, nil -} - type testTarget struct { - current *objectSDK.Object - payload []byte objects []*objectSDK.Object } -func (tt *testTarget) WriteHeader(_ context.Context, object *objectSDK.Object) error { - tt.current = object - return nil -} - -func (tt *testTarget) Write(_ context.Context, p []byte) (n int, err error) { - tt.payload = append(tt.payload, p...) - return len(p), nil -} - -func (tt *testTarget) Close(_ context.Context) (*AccessIdentifiers, error) { - tt.current.SetPayload(tt.payload) - tt.objects = append(tt.objects, tt.current) - tt.current = nil - tt.payload = nil - return nil, nil // AccessIdentifiers should not be used. +func (tt *testTarget) WriteObject(_ context.Context, o *objectSDK.Object) error { + tt.objects = append(tt.objects, o) + return nil // AccessIdentifiers should not be used. } diff --git a/object/transformer/types.go b/object/transformer/types.go index a7e827c..212f453 100644 --- a/object/transformer/types.go +++ b/object/transformer/types.go @@ -21,8 +21,9 @@ type EpochSource interface { CurrentEpoch() uint64 } -// ObjectTarget is an interface of the object writer. -type ObjectTarget interface { +// ChunkedObjectWriter is an interface of the object writer +// that writes object chunked. +type ChunkedObjectWriter interface { // WriteHeader writes object header w/ payload part. // The payload of the object may be incomplete. // @@ -51,5 +52,11 @@ type ObjectTarget interface { Close(context.Context) (*AccessIdentifiers, error) } -// TargetInitializer represents ObjectTarget constructor. -type TargetInitializer func() ObjectTarget +// TargetInitializer represents ObjectWriter constructor. +type TargetInitializer func() ObjectWriter + +// ObjectWriter is an interface of the object writer that writes prepared object. +type ObjectWriter interface { + // WriteObject writes prepared object. + WriteObject(context.Context, *object.Object) error +} From 998fe1a7ab31ce68af433da02220754e8fd0b811 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 10 Jul 2023 14:49:40 +0300 Subject: [PATCH 048/323] [#102] netmap: properly process multiple REP Signed-off-by: Evgenii Stratonikov --- netmap/netmap.go | 28 +++++------------ netmap/selector_test.go | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 21 deletions(-) diff --git a/netmap/netmap.go b/netmap/netmap.go index 7da41a8..e1a5f7d 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -188,30 +188,16 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e for i := range p.replicas { sName := p.replicas[i].GetSelector() if sName == "" { - if len(p.selectors) == 0 { - var s netmap.Selector - s.SetCount(p.replicas[i].GetCount()) - s.SetFilter(mainFilterName) + var s netmap.Selector + s.SetCount(p.replicas[i].GetCount()) + s.SetFilter(mainFilterName) - nodes, err := c.getSelection(s) - if err != nil { - return nil, err - } - - result[i] = flattenNodes(nodes) + nodes, err := c.getSelection(s) + if err != nil { + return nil, err } - for i := range p.selectors { - if p.unique { - nodes, err := c.getSelection(p.selectors[i]) - if err != nil { - return nil, err - } - result[i] = append(result[i], flattenNodes(nodes)...) - } else { - result[i] = append(result[i], flattenNodes(c.selections[p.selectors[i].GetName()])...) - } - } + result[i] = append(result[i], flattenNodes(nodes)...) if p.unique { c.addUsedNodes(result[i]...) diff --git a/netmap/selector_test.go b/netmap/selector_test.go index a80d922..ccb5eb2 100644 --- a/netmap/selector_test.go +++ b/netmap/selector_test.go @@ -282,6 +282,73 @@ func TestPlacementPolicy_Unique(t *testing.T) { } } +func TestPlacementPolicy_MultiREP(t *testing.T) { + nodes := []NodeInfo{ + nodeInfoFromAttributes("ID", "1", "Country", "Russia", "City", "SPB"), + nodeInfoFromAttributes("ID", "2", "Country", "Germany", "City", "Berlin"), + nodeInfoFromAttributes("ID", "3", "Country", "Russia", "City", "Moscow"), + nodeInfoFromAttributes("ID", "4", "Country", "France", "City", "Paris"), + nodeInfoFromAttributes("ID", "5", "Country", "France", "City", "Lyon"), + nodeInfoFromAttributes("ID", "6", "Country", "Russia", "City", "SPB"), + nodeInfoFromAttributes("ID", "7", "Country", "Russia", "City", "Moscow"), + nodeInfoFromAttributes("ID", "8", "Country", "Germany", "City", "Darmstadt"), + nodeInfoFromAttributes("ID", "9", "Country", "Germany", "City", "Frankfurt"), + nodeInfoFromAttributes("ID", "10", "Country", "Russia", "City", "SPB"), + nodeInfoFromAttributes("ID", "11", "Country", "Russia", "City", "Moscow"), + nodeInfoFromAttributes("ID", "12", "Country", "Germany", "City", "London"), + } + for i := range nodes { + pub := make([]byte, 33) + rand.Read(pub) + nodes[i].SetPublicKey(pub) + } + + var nm NetMap + nm.SetNodes(nodes) + + ss := []Selector{newSelector("SameRU", "City", 2, "FromRU", (*Selector).SelectDistinct)} + fs := []Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)} + + for _, unique := range []bool{false, true} { + for _, additional := range []int{0, 1, 2} { + t.Run(fmt.Sprintf("unique=%t, additional=%d", unique, additional), func(t *testing.T) { + rs := []ReplicaDescriptor{newReplica(1, "SameRU")} + for i := 0; i < additional; i++ { + rs = append(rs, newReplica(1, "")) + } + + p := newPlacementPolicy(3, rs, ss, fs) + p.unique = unique + + v, err := nm.ContainerNodes(p, []byte{1}) + require.NoError(t, err) + require.Equal(t, 1+additional, len(v)) + require.Equal(t, 6, len(v[0])) + + for i := 1; i < additional; i++ { + require.Equal(t, 3, len(v[i])) + if !unique { + require.Equal(t, v[1], v[i]) + } + } + + if unique { + seen := make(map[string]bool) + for i := range v { + for j := range v[i] { + attr := v[i][j].Attribute("ID") + require.NotEmpty(t, attr) + require.False(t, seen[attr]) + + seen[attr] = true + } + } + } + }) + } + } +} + func TestPlacementPolicy_ProcessSelectorsExceptForNodes(t *testing.T) { p := newPlacementPolicy(1, nil, []Selector{ From b9afe7a2f95245ca981ce6e63c0523aa9ddafb05 Mon Sep 17 00:00:00 2001 From: Pavel Pogodaev Date: Mon, 10 Jul 2023 09:56:37 +0300 Subject: [PATCH 049/323] [#42] Add ResolveContractHash method Signed-off-by: Pavel Pogodaev --- ns/nns.go | 44 ++++++++++++++++++++++++++ ns/nns_test.go | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) diff --git a/ns/nns.go b/ns/nns.go index cb8dbd4..4af72f4 100644 --- a/ns/nns.go +++ b/ns/nns.go @@ -10,6 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "github.com/nspcc-dev/neo-go/pkg/rpcclient" "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" @@ -116,3 +117,46 @@ func (n *NNS) ResolveContainerDomain(domain container.Domain) (cid.ID, error) { return cid.ID{}, errNotFound } + +// ResolveContractHash looks up for NNS TXT records for the given container domain +// by calling `resolve` method of NNS contract. Returns the first record which represents +// valid contract hash 20 bytes long unsigned integer. Otherwise, returns an error. +// +// ResolveContractHash MUST NOT be called before successful Dial. +// +// See also https://docs.neo.org/docs/en-us/reference/nns.html. +func (n *NNS) ResolveContractHash(domain container.Domain) (util.Uint160, error) { + item, err := unwrap.Item(n.invoker.Call(n.nnsContract, "resolve", + domain.Name()+"."+domain.Zone(), int64(nns.TXT), + )) + if err != nil { + return util.Uint160{}, fmt.Errorf("contract invocation: %w", err) + } + + if _, ok := item.(stackitem.Null); !ok { + arr, ok := item.Value().([]stackitem.Item) + if !ok { + // unexpected for types from stackitem package + return util.Uint160{}, errors.New("invalid cast to stack item slice") + } + + for i := range arr { + recordValue, err := arr[i].TryBytes() + if err != nil { + return util.Uint160{}, fmt.Errorf("convert array item to byte slice: %w", err) + } + + strRecordValue := string(recordValue) + scriptHash, err := address.StringToUint160(strRecordValue) + if err == nil { + return scriptHash, nil + } + scriptHash, err = util.Uint160DecodeStringLE(strRecordValue) + if err == nil { + return scriptHash, nil + } + } + } + + return util.Uint160{}, errNotFound +} diff --git a/ns/nns_test.go b/ns/nns_test.go index 3180ac4..9970b88 100644 --- a/ns/nns_test.go +++ b/ns/nns_test.go @@ -154,3 +154,86 @@ func TestNNS_ResolveContainerDomain(t *testing.T) { require.Equal(t, id, res) }) } + +func TestNNS_ResolveContractHash(t *testing.T) { + var testContainerDomain container.Domain + testContainerDomain.SetName("some_container") + + var nnsContract util.Uint160 + + rand.Read(nnsContract[:]) + + testC := &testNeoClient{ + t: t, + expectedContract: nnsContract, + } + + n := NNS{ + nnsContract: nnsContract, + invoker: testC, + } + + t.Run("invocation failure", func(t *testing.T) { + err1 := errors.New("invoke err") + testC.err = err1 + + _, err2 := n.ResolveContractHash(testContainerDomain) + require.ErrorIs(t, err2, err1) + }) + + testC.err = nil + + t.Run("fault exception", func(t *testing.T) { + _, err := n.ResolveContractHash(testContainerDomain) + require.Error(t, err) + }) + + testC.res.State = vmstate.Halt.String() + + t.Run("empty stack", func(t *testing.T) { + _, err := n.ResolveContractHash(testContainerDomain) + require.Error(t, err) + }) + + testC.res.Stack = make([]stackitem.Item, 1) + + t.Run("non-array last stack item", func(t *testing.T) { + testC.res.Stack[0] = stackitem.NewBigInteger(big.NewInt(11)) + + _, err := n.ResolveContractHash(testContainerDomain) + require.Error(t, err) + }) + + t.Run("null array", func(t *testing.T) { + testC.res.Stack[0] = stackitem.Null{} + + _, err := n.ResolveContractHash(testContainerDomain) + require.ErrorIs(t, err, errNotFound) + }) + + t.Run("array stack item with non-slice value", func(t *testing.T) { + testC.res.Stack[0] = brokenArrayStackItem{} + + _, err := n.ResolveContractHash(testContainerDomain) + require.Error(t, err) + }) + + arr := make([]stackitem.Item, 2) + testC.res.Stack[0] = stackitem.NewArray(arr) + + t.Run("non-bytes array element", func(t *testing.T) { + arr[0] = stackitem.NewArray(nil) + + _, err := n.ResolveContractHash(testContainerDomain) + require.Error(t, err) + }) + + arr[0] = stackitem.NewByteArray([]byte("some byte array 1")) + + t.Run("non-container array elements", func(t *testing.T) { + arr[1] = stackitem.NewByteArray([]byte("some byte array 2")) + + _, err := n.ResolveContractHash(testContainerDomain) + require.Error(t, err) + }) +} From b91f9d8c7910c7493c036a4d007180fc07a74777 Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Thu, 13 Jul 2023 16:12:47 +0300 Subject: [PATCH 050/323] [#xx] Add support for SELECT-FILTER expressions Signed-off-by: Alejandro Lopez --- netmap/netmap.go | 51 +++ netmap/parser/Query.g4 | 2 + netmap/parser/Query.interp | 3 +- netmap/parser/query_base_visitor.go | 4 + netmap/parser/query_parser.go | 567 +++++++++++++++++++--------- netmap/parser/query_visitor.go | 3 + netmap/policy.go | 71 ++++ netmap/policy_test.go | 25 ++ 8 files changed, 556 insertions(+), 170 deletions(-) diff --git a/netmap/netmap.go b/netmap/netmap.go index e1a5f7d..3e8d680 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -158,6 +158,57 @@ func (m NetMap) PlacementVectors(vectors [][]NodeInfo, pivot []byte) ([][]NodeIn return result, nil } +// SelectFilterNodes returns a two-dimensional list of nodes as a result of applying the +// given SelectFilterExpr to the NetMap. +// If the SelectFilterExpr contains only filters, the result contains a single row with the +// result of the last filter application. +// If the SelectFilterExpr contains only selectors, the result contains the selection rows +// of the last select application. +func (m NetMap) SelectFilterNodes(expr *SelectFilterExpr) ([][]NodeInfo, error) { + p := PlacementPolicy{ + filters: expr.filters, + } + + if expr.selector != nil { + p.selectors = append(p.selectors, *expr.selector) + } + + c := newContext(m) + c.setCBF(expr.cbf) + + if err := c.processFilters(p); err != nil { + return nil, err + } + if err := c.processSelectors(p); err != nil { + return nil, err + } + + if expr.selector == nil { + var ret []NodeInfo + lastFilter := expr.filters[len(expr.filters)-1] + for _, ni := range m.nodes { + if c.match(c.processedFilters[lastFilter.GetName()], ni) { + ret = append(ret, ni) + } + } + return [][]NodeInfo{ret}, nil + } + + sel, err := c.getSelection(*c.processedSelectors[expr.selector.GetName()]) + if err != nil { + return nil, err + } + + var ret [][]NodeInfo + for i, ns := range sel { + ret = append(ret, []NodeInfo{}) + for _, n := range ns { + ret[i] = append(ret[i], n) + } + } + return ret, nil +} + // ContainerNodes returns two-dimensional list of nodes as a result of applying // given PlacementPolicy to the NetMap. Each line of the list corresponds to a // replica descriptor. Line order corresponds to order of ReplicaDescriptor list diff --git a/netmap/parser/Query.g4 b/netmap/parser/Query.g4 index abae181..72fa880 100644 --- a/netmap/parser/Query.g4 +++ b/netmap/parser/Query.g4 @@ -6,6 +6,8 @@ options { policy: UNIQUE? repStmt+ cbfStmt? selectStmt* filterStmt* EOF; +selectFilterExpr: cbfStmt? selectStmt? filterStmt* EOF; + repStmt: REP Count = NUMBER1 // number of object replicas (IN Selector = ident)?; // optional selector name diff --git a/netmap/parser/Query.interp b/netmap/parser/Query.interp index df98c28..a8fb219 100644 --- a/netmap/parser/Query.interp +++ b/netmap/parser/Query.interp @@ -52,6 +52,7 @@ WS rule names: policy +selectFilterExpr repStmt cbfStmt selectStmt @@ -68,4 +69,4 @@ identWC atn: -[4, 1, 23, 138, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 3, 0, 30, 8, 0, 1, 0, 4, 0, 33, 8, 0, 11, 0, 12, 0, 34, 1, 0, 3, 0, 38, 8, 0, 1, 0, 5, 0, 41, 8, 0, 10, 0, 12, 0, 44, 9, 0, 1, 0, 5, 0, 47, 8, 0, 10, 0, 12, 0, 50, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 58, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 3, 3, 70, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 76, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 91, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 99, 8, 5, 10, 5, 12, 5, 102, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 115, 8, 7, 1, 8, 1, 8, 3, 8, 119, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 124, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 132, 8, 12, 1, 13, 1, 13, 3, 13, 136, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 142, 0, 29, 1, 0, 0, 0, 2, 53, 1, 0, 0, 0, 4, 59, 1, 0, 0, 0, 6, 62, 1, 0, 0, 0, 8, 77, 1, 0, 0, 0, 10, 90, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 114, 1, 0, 0, 0, 16, 118, 1, 0, 0, 0, 18, 123, 1, 0, 0, 0, 20, 125, 1, 0, 0, 0, 22, 127, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 135, 1, 0, 0, 0, 28, 30, 5, 5, 0, 0, 29, 28, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 32, 1, 0, 0, 0, 31, 33, 3, 2, 1, 0, 32, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 3, 4, 2, 0, 37, 36, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 42, 1, 0, 0, 0, 39, 41, 3, 6, 3, 0, 40, 39, 1, 0, 0, 0, 41, 44, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 48, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 45, 47, 3, 12, 6, 0, 46, 45, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 52, 5, 0, 0, 1, 52, 1, 1, 0, 0, 0, 53, 54, 5, 6, 0, 0, 54, 57, 5, 20, 0, 0, 55, 56, 5, 7, 0, 0, 56, 58, 3, 24, 12, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 3, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 61, 5, 20, 0, 0, 61, 5, 1, 0, 0, 0, 62, 63, 5, 10, 0, 0, 63, 69, 5, 20, 0, 0, 64, 66, 5, 7, 0, 0, 65, 67, 3, 8, 4, 0, 66, 65, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 3, 24, 12, 0, 69, 64, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 72, 5, 11, 0, 0, 72, 75, 3, 26, 13, 0, 73, 74, 5, 8, 0, 0, 74, 76, 3, 24, 12, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 7, 1, 0, 0, 0, 77, 78, 7, 0, 0, 0, 78, 9, 1, 0, 0, 0, 79, 80, 6, 5, -1, 0, 80, 81, 5, 1, 0, 0, 81, 82, 5, 16, 0, 0, 82, 83, 3, 10, 5, 0, 83, 84, 5, 17, 0, 0, 84, 91, 1, 0, 0, 0, 85, 86, 5, 16, 0, 0, 86, 87, 3, 10, 5, 0, 87, 88, 5, 17, 0, 0, 88, 91, 1, 0, 0, 0, 89, 91, 3, 14, 7, 0, 90, 79, 1, 0, 0, 0, 90, 85, 1, 0, 0, 0, 90, 89, 1, 0, 0, 0, 91, 100, 1, 0, 0, 0, 92, 93, 10, 4, 0, 0, 93, 94, 5, 2, 0, 0, 94, 99, 3, 10, 5, 5, 95, 96, 10, 3, 0, 0, 96, 97, 5, 3, 0, 0, 97, 99, 3, 10, 5, 4, 98, 92, 1, 0, 0, 0, 98, 95, 1, 0, 0, 0, 99, 102, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 11, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 103, 104, 5, 12, 0, 0, 104, 105, 3, 10, 5, 0, 105, 106, 5, 8, 0, 0, 106, 107, 3, 24, 12, 0, 107, 13, 1, 0, 0, 0, 108, 109, 5, 18, 0, 0, 109, 115, 3, 24, 12, 0, 110, 111, 3, 16, 8, 0, 111, 112, 5, 4, 0, 0, 112, 113, 3, 18, 9, 0, 113, 115, 1, 0, 0, 0, 114, 108, 1, 0, 0, 0, 114, 110, 1, 0, 0, 0, 115, 15, 1, 0, 0, 0, 116, 119, 3, 24, 12, 0, 117, 119, 5, 22, 0, 0, 118, 116, 1, 0, 0, 0, 118, 117, 1, 0, 0, 0, 119, 17, 1, 0, 0, 0, 120, 124, 3, 24, 12, 0, 121, 124, 3, 20, 10, 0, 122, 124, 5, 22, 0, 0, 123, 120, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 19, 1, 0, 0, 0, 125, 126, 7, 1, 0, 0, 126, 21, 1, 0, 0, 0, 127, 128, 7, 2, 0, 0, 128, 23, 1, 0, 0, 0, 129, 132, 3, 22, 11, 0, 130, 132, 5, 19, 0, 0, 131, 129, 1, 0, 0, 0, 131, 130, 1, 0, 0, 0, 132, 25, 1, 0, 0, 0, 133, 136, 3, 24, 12, 0, 134, 136, 5, 13, 0, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 27, 1, 0, 0, 0, 17, 29, 34, 37, 42, 48, 57, 66, 69, 75, 90, 98, 100, 114, 118, 123, 131, 135] \ No newline at end of file +[4, 1, 23, 154, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 3, 0, 32, 8, 0, 1, 0, 4, 0, 35, 8, 0, 11, 0, 12, 0, 36, 1, 0, 3, 0, 40, 8, 0, 1, 0, 5, 0, 43, 8, 0, 10, 0, 12, 0, 46, 9, 0, 1, 0, 5, 0, 49, 8, 0, 10, 0, 12, 0, 52, 9, 0, 1, 0, 1, 0, 1, 1, 3, 1, 57, 8, 1, 1, 1, 3, 1, 60, 8, 1, 1, 1, 5, 1, 63, 8, 1, 10, 1, 12, 1, 66, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 74, 8, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 83, 8, 4, 1, 4, 3, 4, 86, 8, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 92, 8, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 107, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 115, 8, 6, 10, 6, 12, 6, 118, 9, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 131, 8, 8, 1, 9, 1, 9, 3, 9, 135, 8, 9, 1, 10, 1, 10, 1, 10, 3, 10, 140, 8, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 3, 13, 148, 8, 13, 1, 14, 1, 14, 3, 14, 152, 8, 14, 1, 14, 0, 1, 12, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 3, 1, 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 160, 0, 31, 1, 0, 0, 0, 2, 56, 1, 0, 0, 0, 4, 69, 1, 0, 0, 0, 6, 75, 1, 0, 0, 0, 8, 78, 1, 0, 0, 0, 10, 93, 1, 0, 0, 0, 12, 106, 1, 0, 0, 0, 14, 119, 1, 0, 0, 0, 16, 130, 1, 0, 0, 0, 18, 134, 1, 0, 0, 0, 20, 139, 1, 0, 0, 0, 22, 141, 1, 0, 0, 0, 24, 143, 1, 0, 0, 0, 26, 147, 1, 0, 0, 0, 28, 151, 1, 0, 0, 0, 30, 32, 5, 5, 0, 0, 31, 30, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 34, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 40, 3, 6, 3, 0, 39, 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 44, 1, 0, 0, 0, 41, 43, 3, 8, 4, 0, 42, 41, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 50, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 49, 3, 14, 7, 0, 48, 47, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, 1, 1, 0, 0, 0, 55, 57, 3, 6, 3, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 59, 1, 0, 0, 0, 58, 60, 3, 8, 4, 0, 59, 58, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 64, 1, 0, 0, 0, 61, 63, 3, 14, 7, 0, 62, 61, 1, 0, 0, 0, 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 5, 0, 0, 1, 68, 3, 1, 0, 0, 0, 69, 70, 5, 6, 0, 0, 70, 73, 5, 20, 0, 0, 71, 72, 5, 7, 0, 0, 72, 74, 3, 26, 13, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 5, 1, 0, 0, 0, 75, 76, 5, 9, 0, 0, 76, 77, 5, 20, 0, 0, 77, 7, 1, 0, 0, 0, 78, 79, 5, 10, 0, 0, 79, 85, 5, 20, 0, 0, 80, 82, 5, 7, 0, 0, 81, 83, 3, 10, 5, 0, 82, 81, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 86, 3, 26, 13, 0, 85, 80, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 88, 5, 11, 0, 0, 88, 91, 3, 28, 14, 0, 89, 90, 5, 8, 0, 0, 90, 92, 3, 26, 13, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 9, 1, 0, 0, 0, 93, 94, 7, 0, 0, 0, 94, 11, 1, 0, 0, 0, 95, 96, 6, 6, -1, 0, 96, 97, 5, 1, 0, 0, 97, 98, 5, 16, 0, 0, 98, 99, 3, 12, 6, 0, 99, 100, 5, 17, 0, 0, 100, 107, 1, 0, 0, 0, 101, 102, 5, 16, 0, 0, 102, 103, 3, 12, 6, 0, 103, 104, 5, 17, 0, 0, 104, 107, 1, 0, 0, 0, 105, 107, 3, 16, 8, 0, 106, 95, 1, 0, 0, 0, 106, 101, 1, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 116, 1, 0, 0, 0, 108, 109, 10, 4, 0, 0, 109, 110, 5, 2, 0, 0, 110, 115, 3, 12, 6, 5, 111, 112, 10, 3, 0, 0, 112, 113, 5, 3, 0, 0, 113, 115, 3, 12, 6, 4, 114, 108, 1, 0, 0, 0, 114, 111, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 13, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 119, 120, 5, 12, 0, 0, 120, 121, 3, 12, 6, 0, 121, 122, 5, 8, 0, 0, 122, 123, 3, 26, 13, 0, 123, 15, 1, 0, 0, 0, 124, 125, 5, 18, 0, 0, 125, 131, 3, 26, 13, 0, 126, 127, 3, 18, 9, 0, 127, 128, 5, 4, 0, 0, 128, 129, 3, 20, 10, 0, 129, 131, 1, 0, 0, 0, 130, 124, 1, 0, 0, 0, 130, 126, 1, 0, 0, 0, 131, 17, 1, 0, 0, 0, 132, 135, 3, 26, 13, 0, 133, 135, 5, 22, 0, 0, 134, 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 19, 1, 0, 0, 0, 136, 140, 3, 26, 13, 0, 137, 140, 3, 22, 11, 0, 138, 140, 5, 22, 0, 0, 139, 136, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 21, 1, 0, 0, 0, 141, 142, 7, 1, 0, 0, 142, 23, 1, 0, 0, 0, 143, 144, 7, 2, 0, 0, 144, 25, 1, 0, 0, 0, 145, 148, 3, 24, 12, 0, 146, 148, 5, 19, 0, 0, 147, 145, 1, 0, 0, 0, 147, 146, 1, 0, 0, 0, 148, 27, 1, 0, 0, 0, 149, 152, 3, 26, 13, 0, 150, 152, 5, 13, 0, 0, 151, 149, 1, 0, 0, 0, 151, 150, 1, 0, 0, 0, 152, 29, 1, 0, 0, 0, 20, 31, 36, 39, 44, 50, 56, 59, 64, 73, 82, 85, 91, 106, 114, 116, 130, 134, 139, 147, 151] \ No newline at end of file diff --git a/netmap/parser/query_base_visitor.go b/netmap/parser/query_base_visitor.go index 4badbce..981106f 100644 --- a/netmap/parser/query_base_visitor.go +++ b/netmap/parser/query_base_visitor.go @@ -12,6 +12,10 @@ func (v *BaseQueryVisitor) VisitPolicy(ctx *PolicyContext) interface{} { return v.VisitChildren(ctx) } +func (v *BaseQueryVisitor) VisitSelectFilterExpr(ctx *SelectFilterExprContext) interface{} { + return v.VisitChildren(ctx) +} + func (v *BaseQueryVisitor) VisitRepStmt(ctx *RepStmtContext) interface{} { return v.VisitChildren(ctx) } diff --git a/netmap/parser/query_parser.go b/netmap/parser/query_parser.go index 6357727..db19c93 100644 --- a/netmap/parser/query_parser.go +++ b/netmap/parser/query_parser.go @@ -44,70 +44,77 @@ func queryParserInit() { "STRING", "WS", } staticData.RuleNames = []string{ - "policy", "repStmt", "cbfStmt", "selectStmt", "clause", "filterExpr", - "filterStmt", "expr", "filterKey", "filterValue", "number", "keyword", - "ident", "identWC", + "policy", "selectFilterExpr", "repStmt", "cbfStmt", "selectStmt", "clause", + "filterExpr", "filterStmt", "expr", "filterKey", "filterValue", "number", + "keyword", "ident", "identWC", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 23, 138, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 23, 154, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, - 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 3, 0, 30, 8, 0, 1, - 0, 4, 0, 33, 8, 0, 11, 0, 12, 0, 34, 1, 0, 3, 0, 38, 8, 0, 1, 0, 5, 0, - 41, 8, 0, 10, 0, 12, 0, 44, 9, 0, 1, 0, 5, 0, 47, 8, 0, 10, 0, 12, 0, 50, - 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 58, 8, 1, 1, 2, 1, 2, 1, - 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 3, 3, 70, 8, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 3, 3, 76, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, - 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 91, 8, 5, 1, 5, 1, 5, 1, 5, - 1, 5, 1, 5, 1, 5, 5, 5, 99, 8, 5, 10, 5, 12, 5, 102, 9, 5, 1, 6, 1, 6, - 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 115, 8, 7, - 1, 8, 1, 8, 3, 8, 119, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 124, 8, 9, 1, 10, - 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 132, 8, 12, 1, 13, 1, 13, 3, - 13, 136, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, - 20, 22, 24, 26, 0, 3, 1, 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 142, - 0, 29, 1, 0, 0, 0, 2, 53, 1, 0, 0, 0, 4, 59, 1, 0, 0, 0, 6, 62, 1, 0, 0, - 0, 8, 77, 1, 0, 0, 0, 10, 90, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 114, - 1, 0, 0, 0, 16, 118, 1, 0, 0, 0, 18, 123, 1, 0, 0, 0, 20, 125, 1, 0, 0, - 0, 22, 127, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 135, 1, 0, 0, 0, 28, 30, - 5, 5, 0, 0, 29, 28, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 32, 1, 0, 0, 0, - 31, 33, 3, 2, 1, 0, 32, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 32, 1, - 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 3, 4, 2, 0, 37, - 36, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 42, 1, 0, 0, 0, 39, 41, 3, 6, 3, - 0, 40, 39, 1, 0, 0, 0, 41, 44, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 43, - 1, 0, 0, 0, 43, 48, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 45, 47, 3, 12, 6, 0, - 46, 45, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, - 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 52, 5, 0, 0, 1, 52, - 1, 1, 0, 0, 0, 53, 54, 5, 6, 0, 0, 54, 57, 5, 20, 0, 0, 55, 56, 5, 7, 0, - 0, 56, 58, 3, 24, 12, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 3, - 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 61, 5, 20, 0, 0, 61, 5, 1, 0, 0, 0, - 62, 63, 5, 10, 0, 0, 63, 69, 5, 20, 0, 0, 64, 66, 5, 7, 0, 0, 65, 67, 3, - 8, 4, 0, 66, 65, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, - 70, 3, 24, 12, 0, 69, 64, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, - 0, 0, 71, 72, 5, 11, 0, 0, 72, 75, 3, 26, 13, 0, 73, 74, 5, 8, 0, 0, 74, - 76, 3, 24, 12, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 7, 1, 0, - 0, 0, 77, 78, 7, 0, 0, 0, 78, 9, 1, 0, 0, 0, 79, 80, 6, 5, -1, 0, 80, 81, - 5, 1, 0, 0, 81, 82, 5, 16, 0, 0, 82, 83, 3, 10, 5, 0, 83, 84, 5, 17, 0, - 0, 84, 91, 1, 0, 0, 0, 85, 86, 5, 16, 0, 0, 86, 87, 3, 10, 5, 0, 87, 88, - 5, 17, 0, 0, 88, 91, 1, 0, 0, 0, 89, 91, 3, 14, 7, 0, 90, 79, 1, 0, 0, - 0, 90, 85, 1, 0, 0, 0, 90, 89, 1, 0, 0, 0, 91, 100, 1, 0, 0, 0, 92, 93, - 10, 4, 0, 0, 93, 94, 5, 2, 0, 0, 94, 99, 3, 10, 5, 5, 95, 96, 10, 3, 0, - 0, 96, 97, 5, 3, 0, 0, 97, 99, 3, 10, 5, 4, 98, 92, 1, 0, 0, 0, 98, 95, - 1, 0, 0, 0, 99, 102, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, - 0, 101, 11, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 103, 104, 5, 12, 0, 0, 104, - 105, 3, 10, 5, 0, 105, 106, 5, 8, 0, 0, 106, 107, 3, 24, 12, 0, 107, 13, - 1, 0, 0, 0, 108, 109, 5, 18, 0, 0, 109, 115, 3, 24, 12, 0, 110, 111, 3, - 16, 8, 0, 111, 112, 5, 4, 0, 0, 112, 113, 3, 18, 9, 0, 113, 115, 1, 0, - 0, 0, 114, 108, 1, 0, 0, 0, 114, 110, 1, 0, 0, 0, 115, 15, 1, 0, 0, 0, - 116, 119, 3, 24, 12, 0, 117, 119, 5, 22, 0, 0, 118, 116, 1, 0, 0, 0, 118, - 117, 1, 0, 0, 0, 119, 17, 1, 0, 0, 0, 120, 124, 3, 24, 12, 0, 121, 124, - 3, 20, 10, 0, 122, 124, 5, 22, 0, 0, 123, 120, 1, 0, 0, 0, 123, 121, 1, - 0, 0, 0, 123, 122, 1, 0, 0, 0, 124, 19, 1, 0, 0, 0, 125, 126, 7, 1, 0, - 0, 126, 21, 1, 0, 0, 0, 127, 128, 7, 2, 0, 0, 128, 23, 1, 0, 0, 0, 129, - 132, 3, 22, 11, 0, 130, 132, 5, 19, 0, 0, 131, 129, 1, 0, 0, 0, 131, 130, - 1, 0, 0, 0, 132, 25, 1, 0, 0, 0, 133, 136, 3, 24, 12, 0, 134, 136, 5, 13, - 0, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 27, 1, 0, 0, 0, - 17, 29, 34, 37, 42, 48, 57, 66, 69, 75, 90, 98, 100, 114, 118, 123, 131, - 135, + 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 3, 0, + 32, 8, 0, 1, 0, 4, 0, 35, 8, 0, 11, 0, 12, 0, 36, 1, 0, 3, 0, 40, 8, 0, + 1, 0, 5, 0, 43, 8, 0, 10, 0, 12, 0, 46, 9, 0, 1, 0, 5, 0, 49, 8, 0, 10, + 0, 12, 0, 52, 9, 0, 1, 0, 1, 0, 1, 1, 3, 1, 57, 8, 1, 1, 1, 3, 1, 60, 8, + 1, 1, 1, 5, 1, 63, 8, 1, 10, 1, 12, 1, 66, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, + 1, 2, 1, 2, 3, 2, 74, 8, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 3, + 4, 83, 8, 4, 1, 4, 3, 4, 86, 8, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 92, 8, + 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, + 6, 1, 6, 3, 6, 107, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 115, + 8, 6, 10, 6, 12, 6, 118, 9, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, + 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 131, 8, 8, 1, 9, 1, 9, 3, 9, 135, 8, 9, 1, + 10, 1, 10, 1, 10, 3, 10, 140, 8, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, + 1, 13, 3, 13, 148, 8, 13, 1, 14, 1, 14, 3, 14, 152, 8, 14, 1, 14, 0, 1, + 12, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 3, 1, + 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 160, 0, 31, 1, 0, 0, 0, 2, + 56, 1, 0, 0, 0, 4, 69, 1, 0, 0, 0, 6, 75, 1, 0, 0, 0, 8, 78, 1, 0, 0, 0, + 10, 93, 1, 0, 0, 0, 12, 106, 1, 0, 0, 0, 14, 119, 1, 0, 0, 0, 16, 130, + 1, 0, 0, 0, 18, 134, 1, 0, 0, 0, 20, 139, 1, 0, 0, 0, 22, 141, 1, 0, 0, + 0, 24, 143, 1, 0, 0, 0, 26, 147, 1, 0, 0, 0, 28, 151, 1, 0, 0, 0, 30, 32, + 5, 5, 0, 0, 31, 30, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, + 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 34, 1, + 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 40, 3, 6, 3, 0, 39, + 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 44, 1, 0, 0, 0, 41, 43, 3, 8, 4, + 0, 42, 41, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, + 1, 0, 0, 0, 45, 50, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 49, 3, 14, 7, 0, + 48, 47, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, + 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, + 1, 1, 0, 0, 0, 55, 57, 3, 6, 3, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, + 0, 57, 59, 1, 0, 0, 0, 58, 60, 3, 8, 4, 0, 59, 58, 1, 0, 0, 0, 59, 60, + 1, 0, 0, 0, 60, 64, 1, 0, 0, 0, 61, 63, 3, 14, 7, 0, 62, 61, 1, 0, 0, 0, + 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 1, + 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 5, 0, 0, 1, 68, 3, 1, 0, 0, 0, 69, + 70, 5, 6, 0, 0, 70, 73, 5, 20, 0, 0, 71, 72, 5, 7, 0, 0, 72, 74, 3, 26, + 13, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 5, 1, 0, 0, 0, 75, 76, + 5, 9, 0, 0, 76, 77, 5, 20, 0, 0, 77, 7, 1, 0, 0, 0, 78, 79, 5, 10, 0, 0, + 79, 85, 5, 20, 0, 0, 80, 82, 5, 7, 0, 0, 81, 83, 3, 10, 5, 0, 82, 81, 1, + 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 86, 3, 26, 13, 0, + 85, 80, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 88, 5, + 11, 0, 0, 88, 91, 3, 28, 14, 0, 89, 90, 5, 8, 0, 0, 90, 92, 3, 26, 13, + 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 9, 1, 0, 0, 0, 93, 94, 7, + 0, 0, 0, 94, 11, 1, 0, 0, 0, 95, 96, 6, 6, -1, 0, 96, 97, 5, 1, 0, 0, 97, + 98, 5, 16, 0, 0, 98, 99, 3, 12, 6, 0, 99, 100, 5, 17, 0, 0, 100, 107, 1, + 0, 0, 0, 101, 102, 5, 16, 0, 0, 102, 103, 3, 12, 6, 0, 103, 104, 5, 17, + 0, 0, 104, 107, 1, 0, 0, 0, 105, 107, 3, 16, 8, 0, 106, 95, 1, 0, 0, 0, + 106, 101, 1, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 116, 1, 0, 0, 0, 108, + 109, 10, 4, 0, 0, 109, 110, 5, 2, 0, 0, 110, 115, 3, 12, 6, 5, 111, 112, + 10, 3, 0, 0, 112, 113, 5, 3, 0, 0, 113, 115, 3, 12, 6, 4, 114, 108, 1, + 0, 0, 0, 114, 111, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, 116, 114, 1, 0, 0, + 0, 116, 117, 1, 0, 0, 0, 117, 13, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 119, + 120, 5, 12, 0, 0, 120, 121, 3, 12, 6, 0, 121, 122, 5, 8, 0, 0, 122, 123, + 3, 26, 13, 0, 123, 15, 1, 0, 0, 0, 124, 125, 5, 18, 0, 0, 125, 131, 3, + 26, 13, 0, 126, 127, 3, 18, 9, 0, 127, 128, 5, 4, 0, 0, 128, 129, 3, 20, + 10, 0, 129, 131, 1, 0, 0, 0, 130, 124, 1, 0, 0, 0, 130, 126, 1, 0, 0, 0, + 131, 17, 1, 0, 0, 0, 132, 135, 3, 26, 13, 0, 133, 135, 5, 22, 0, 0, 134, + 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 19, 1, 0, 0, 0, 136, 140, 3, + 26, 13, 0, 137, 140, 3, 22, 11, 0, 138, 140, 5, 22, 0, 0, 139, 136, 1, + 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 21, 1, 0, 0, + 0, 141, 142, 7, 1, 0, 0, 142, 23, 1, 0, 0, 0, 143, 144, 7, 2, 0, 0, 144, + 25, 1, 0, 0, 0, 145, 148, 3, 24, 12, 0, 146, 148, 5, 19, 0, 0, 147, 145, + 1, 0, 0, 0, 147, 146, 1, 0, 0, 0, 148, 27, 1, 0, 0, 0, 149, 152, 3, 26, + 13, 0, 150, 152, 5, 13, 0, 0, 151, 149, 1, 0, 0, 0, 151, 150, 1, 0, 0, + 0, 152, 29, 1, 0, 0, 0, 20, 31, 36, 39, 44, 50, 56, 59, 64, 73, 82, 85, + 91, 106, 114, 116, 130, 134, 139, 147, 151, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -173,20 +180,21 @@ const ( // Query rules. const ( - QueryRULE_policy = 0 - QueryRULE_repStmt = 1 - QueryRULE_cbfStmt = 2 - QueryRULE_selectStmt = 3 - QueryRULE_clause = 4 - QueryRULE_filterExpr = 5 - QueryRULE_filterStmt = 6 - QueryRULE_expr = 7 - QueryRULE_filterKey = 8 - QueryRULE_filterValue = 9 - QueryRULE_number = 10 - QueryRULE_keyword = 11 - QueryRULE_ident = 12 - QueryRULE_identWC = 13 + QueryRULE_policy = 0 + QueryRULE_selectFilterExpr = 1 + QueryRULE_repStmt = 2 + QueryRULE_cbfStmt = 3 + QueryRULE_selectStmt = 4 + QueryRULE_clause = 5 + QueryRULE_filterExpr = 6 + QueryRULE_filterStmt = 7 + QueryRULE_expr = 8 + QueryRULE_filterKey = 9 + QueryRULE_filterValue = 10 + QueryRULE_number = 11 + QueryRULE_keyword = 12 + QueryRULE_ident = 13 + QueryRULE_identWC = 14 ) // IPolicyContext is an interface to support dynamic dispatch. @@ -414,7 +422,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(29) + p.SetState(31) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -423,7 +431,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { if _la == QueryUNIQUE { { - p.SetState(28) + p.SetState(30) p.Match(QueryUNIQUE) if p.HasError() { // Recognition error - abort rule @@ -432,7 +440,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { } } - p.SetState(32) + p.SetState(34) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -441,18 +449,18 @@ func (p *Query) Policy() (localctx IPolicyContext) { for ok := true; ok; ok = _la == QueryREP { { - p.SetState(31) + p.SetState(33) p.RepStmt() } - p.SetState(34) + p.SetState(36) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(37) + p.SetState(39) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -461,12 +469,12 @@ func (p *Query) Policy() (localctx IPolicyContext) { if _la == QueryCBF { { - p.SetState(36) + p.SetState(38) p.CbfStmt() } } - p.SetState(42) + p.SetState(44) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -475,18 +483,18 @@ func (p *Query) Policy() (localctx IPolicyContext) { for _la == QuerySELECT { { - p.SetState(39) + p.SetState(41) p.SelectStmt() } - p.SetState(44) + p.SetState(46) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(48) + p.SetState(50) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -495,11 +503,11 @@ func (p *Query) Policy() (localctx IPolicyContext) { for _la == QueryFILTER { { - p.SetState(45) + p.SetState(47) p.FilterStmt() } - p.SetState(50) + p.SetState(52) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -507,7 +515,228 @@ func (p *Query) Policy() (localctx IPolicyContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(51) + p.SetState(53) + p.Match(QueryEOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelectFilterExprContext is an interface to support dynamic dispatch. +type ISelectFilterExprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EOF() antlr.TerminalNode + CbfStmt() ICbfStmtContext + SelectStmt() ISelectStmtContext + AllFilterStmt() []IFilterStmtContext + FilterStmt(i int) IFilterStmtContext + + // IsSelectFilterExprContext differentiates from other interfaces. + IsSelectFilterExprContext() +} + +type SelectFilterExprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelectFilterExprContext() *SelectFilterExprContext { + var p = new(SelectFilterExprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_selectFilterExpr + return p +} + +func InitEmptySelectFilterExprContext(p *SelectFilterExprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_selectFilterExpr +} + +func (*SelectFilterExprContext) IsSelectFilterExprContext() {} + +func NewSelectFilterExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelectFilterExprContext { + var p = new(SelectFilterExprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = QueryRULE_selectFilterExpr + + return p +} + +func (s *SelectFilterExprContext) GetParser() antlr.Parser { return s.parser } + +func (s *SelectFilterExprContext) EOF() antlr.TerminalNode { + return s.GetToken(QueryEOF, 0) +} + +func (s *SelectFilterExprContext) CbfStmt() ICbfStmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICbfStmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICbfStmtContext) +} + +func (s *SelectFilterExprContext) SelectStmt() ISelectStmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectStmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectStmtContext) +} + +func (s *SelectFilterExprContext) AllFilterStmt() []IFilterStmtContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFilterStmtContext); ok { + len++ + } + } + + tst := make([]IFilterStmtContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFilterStmtContext); ok { + tst[i] = t.(IFilterStmtContext) + i++ + } + } + + return tst +} + +func (s *SelectFilterExprContext) FilterStmt(i int) IFilterStmtContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFilterStmtContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFilterStmtContext) +} + +func (s *SelectFilterExprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SelectFilterExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SelectFilterExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case QueryVisitor: + return t.VisitSelectFilterExpr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *Query) SelectFilterExpr() (localctx ISelectFilterExprContext) { + localctx = NewSelectFilterExprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 2, QueryRULE_selectFilterExpr) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(56) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == QueryCBF { + { + p.SetState(55) + p.CbfStmt() + } + + } + p.SetState(59) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == QuerySELECT { + { + p.SetState(58) + p.SelectStmt() + } + + } + p.SetState(64) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == QueryFILTER { + { + p.SetState(61) + p.FilterStmt() + } + + p.SetState(66) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(67) p.Match(QueryEOF) if p.HasError() { // Recognition error - abort rule @@ -647,12 +876,12 @@ func (s *RepStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) RepStmt() (localctx IRepStmtContext) { localctx = NewRepStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 2, QueryRULE_repStmt) + p.EnterRule(localctx, 4, QueryRULE_repStmt) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(53) + p.SetState(69) p.Match(QueryREP) if p.HasError() { // Recognition error - abort rule @@ -660,7 +889,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } } { - p.SetState(54) + p.SetState(70) var _m = p.Match(QueryNUMBER1) @@ -670,7 +899,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { goto errorExit } } - p.SetState(57) + p.SetState(73) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -679,7 +908,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { if _la == QueryIN { { - p.SetState(55) + p.SetState(71) p.Match(QueryIN) if p.HasError() { // Recognition error - abort rule @@ -687,7 +916,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } } { - p.SetState(56) + p.SetState(72) var _x = p.Ident() @@ -795,10 +1024,10 @@ func (s *CbfStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) CbfStmt() (localctx ICbfStmtContext) { localctx = NewCbfStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 4, QueryRULE_cbfStmt) + p.EnterRule(localctx, 6, QueryRULE_cbfStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(59) + p.SetState(75) p.Match(QueryCBF) if p.HasError() { // Recognition error - abort rule @@ -806,7 +1035,7 @@ func (p *Query) CbfStmt() (localctx ICbfStmtContext) { } } { - p.SetState(60) + p.SetState(76) var _m = p.Match(QueryNUMBER1) @@ -1041,12 +1270,12 @@ func (s *SelectStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) SelectStmt() (localctx ISelectStmtContext) { localctx = NewSelectStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 6, QueryRULE_selectStmt) + p.EnterRule(localctx, 8, QueryRULE_selectStmt) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(62) + p.SetState(78) p.Match(QuerySELECT) if p.HasError() { // Recognition error - abort rule @@ -1054,7 +1283,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(63) + p.SetState(79) var _m = p.Match(QueryNUMBER1) @@ -1064,7 +1293,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { goto errorExit } } - p.SetState(69) + p.SetState(85) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1073,14 +1302,14 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryIN { { - p.SetState(64) + p.SetState(80) p.Match(QueryIN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(66) + p.SetState(82) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1089,13 +1318,13 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT { { - p.SetState(65) + p.SetState(81) p.Clause() } } { - p.SetState(68) + p.SetState(84) var _x = p.Ident() @@ -1104,7 +1333,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } { - p.SetState(71) + p.SetState(87) p.Match(QueryFROM) if p.HasError() { // Recognition error - abort rule @@ -1112,13 +1341,13 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(72) + p.SetState(88) var _x = p.IdentWC() localctx.(*SelectStmtContext).Filter = _x } - p.SetState(75) + p.SetState(91) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1127,7 +1356,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryAS { { - p.SetState(73) + p.SetState(89) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -1135,7 +1364,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(74) + p.SetState(90) var _x = p.Ident() @@ -1232,12 +1461,12 @@ func (s *ClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Clause() (localctx IClauseContext) { localctx = NewClauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 8, QueryRULE_clause) + p.EnterRule(localctx, 10, QueryRULE_clause) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(77) + p.SetState(93) _la = p.GetTokenStream().LA(1) if !(_la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT) { @@ -1464,12 +1693,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, p.GetParserRuleContext(), _parentState) var _prevctx IFilterExprContext = localctx var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. - _startState := 10 - p.EnterRecursionRule(localctx, 10, QueryRULE_filterExpr, _p) + _startState := 12 + p.EnterRecursionRule(localctx, 12, QueryRULE_filterExpr, _p) var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(90) + p.SetState(106) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1478,7 +1707,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { switch p.GetTokenStream().LA(1) { case QueryNOT_OP: { - p.SetState(80) + p.SetState(96) var _m = p.Match(QueryNOT_OP) @@ -1489,7 +1718,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(81) + p.SetState(97) p.Match(QueryL_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1497,14 +1726,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(82) + p.SetState(98) var _x = p.filterExpr(0) localctx.(*FilterExprContext).F1 = _x } { - p.SetState(83) + p.SetState(99) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1514,7 +1743,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryL_PAREN: { - p.SetState(85) + p.SetState(101) p.Match(QueryL_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1522,14 +1751,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(86) + p.SetState(102) var _x = p.filterExpr(0) localctx.(*FilterExprContext).Inner = _x } { - p.SetState(87) + p.SetState(103) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1539,7 +1768,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING: { - p.SetState(89) + p.SetState(105) p.Expr() } @@ -1548,12 +1777,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(100) + p.SetState(116) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1563,25 +1792,25 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(98) + p.SetState(114) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) { case 1: localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(92) + p.SetState(108) if !(p.Precpred(p.GetParserRuleContext(), 4)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) goto errorExit } { - p.SetState(93) + p.SetState(109) var _m = p.Match(QueryAND_OP) @@ -1592,7 +1821,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(94) + p.SetState(110) var _x = p.filterExpr(5) @@ -1603,14 +1832,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(95) + p.SetState(111) if !(p.Precpred(p.GetParserRuleContext(), 3)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) goto errorExit } { - p.SetState(96) + p.SetState(112) var _m = p.Match(QueryOR_OP) @@ -1621,7 +1850,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(97) + p.SetState(113) var _x = p.filterExpr(4) @@ -1633,12 +1862,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } - p.SetState(102) + p.SetState(118) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1788,10 +2017,10 @@ func (s *FilterStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) FilterStmt() (localctx IFilterStmtContext) { localctx = NewFilterStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 12, QueryRULE_filterStmt) + p.EnterRule(localctx, 14, QueryRULE_filterStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(103) + p.SetState(119) p.Match(QueryFILTER) if p.HasError() { // Recognition error - abort rule @@ -1799,14 +2028,14 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(104) + p.SetState(120) var _x = p.filterExpr(0) localctx.(*FilterStmtContext).Expr = _x } { - p.SetState(105) + p.SetState(121) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -1814,7 +2043,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(106) + p.SetState(122) var _x = p.Ident() @@ -1993,8 +2222,8 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Expr() (localctx IExprContext) { localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 14, QueryRULE_expr) - p.SetState(114) + p.EnterRule(localctx, 16, QueryRULE_expr) + p.SetState(130) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2004,7 +2233,7 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryAT: p.EnterOuterAlt(localctx, 1) { - p.SetState(108) + p.SetState(124) p.Match(QueryAT) if p.HasError() { // Recognition error - abort rule @@ -2012,7 +2241,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(109) + p.SetState(125) var _x = p.Ident() @@ -2022,14 +2251,14 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT, QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(110) + p.SetState(126) var _x = p.FilterKey() localctx.(*ExprContext).Key = _x } { - p.SetState(111) + p.SetState(127) p.Match(QuerySIMPLE_OP) if p.HasError() { // Recognition error - abort rule @@ -2037,7 +2266,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(112) + p.SetState(128) var _x = p.FilterValue() @@ -2149,8 +2378,8 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) FilterKey() (localctx IFilterKeyContext) { localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 16, QueryRULE_filterKey) - p.SetState(118) + p.EnterRule(localctx, 18, QueryRULE_filterKey) + p.SetState(134) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2160,14 +2389,14 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(116) + p.SetState(132) p.Ident() } case QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(117) + p.SetState(133) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2297,8 +2526,8 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *Query) FilterValue() (localctx IFilterValueContext) { localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 18, QueryRULE_filterValue) - p.SetState(123) + p.EnterRule(localctx, 20, QueryRULE_filterValue) + p.SetState(139) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2308,21 +2537,21 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(120) + p.SetState(136) p.Ident() } case QueryNUMBER1, QueryZERO: p.EnterOuterAlt(localctx, 2) { - p.SetState(121) + p.SetState(137) p.Number() } case QuerySTRING: p.EnterOuterAlt(localctx, 3) { - p.SetState(122) + p.SetState(138) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2423,12 +2652,12 @@ func (s *NumberContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Number() (localctx INumberContext) { localctx = NewNumberContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 20, QueryRULE_number) + p.EnterRule(localctx, 22, QueryRULE_number) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(125) + p.SetState(141) _la = p.GetTokenStream().LA(1) if !(_la == QueryNUMBER1 || _la == QueryZERO) { @@ -2547,12 +2776,12 @@ func (s *KeywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Keyword() (localctx IKeywordContext) { localctx = NewKeywordContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 22, QueryRULE_keyword) + p.EnterRule(localctx, 24, QueryRULE_keyword) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(127) + p.SetState(143) _la = p.GetTokenStream().LA(1) if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&7616) != 0) { @@ -2663,8 +2892,8 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Ident() (localctx IIdentContext) { localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, QueryRULE_ident) - p.SetState(131) + p.EnterRule(localctx, 26, QueryRULE_ident) + p.SetState(147) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2674,14 +2903,14 @@ func (p *Query) Ident() (localctx IIdentContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER: p.EnterOuterAlt(localctx, 1) { - p.SetState(129) + p.SetState(145) p.Keyword() } case QueryIDENT: p.EnterOuterAlt(localctx, 2) { - p.SetState(130) + p.SetState(146) p.Match(QueryIDENT) if p.HasError() { // Recognition error - abort rule @@ -2794,8 +3023,8 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) IdentWC() (localctx IIdentWCContext) { localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, QueryRULE_identWC) - p.SetState(135) + p.EnterRule(localctx, 28, QueryRULE_identWC) + p.SetState(151) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2805,14 +3034,14 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(133) + p.SetState(149) p.Ident() } case QueryWILDCARD: p.EnterOuterAlt(localctx, 2) { - p.SetState(134) + p.SetState(150) p.Match(QueryWILDCARD) if p.HasError() { // Recognition error - abort rule @@ -2840,7 +3069,7 @@ errorExit: func (p *Query) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { switch ruleIndex { - case 5: + case 6: var t *FilterExprContext = nil if localctx != nil { t = localctx.(*FilterExprContext) diff --git a/netmap/parser/query_visitor.go b/netmap/parser/query_visitor.go index 960dc2f..7550d99 100644 --- a/netmap/parser/query_visitor.go +++ b/netmap/parser/query_visitor.go @@ -11,6 +11,9 @@ type QueryVisitor interface { // Visit a parse tree produced by Query#policy. VisitPolicy(ctx *PolicyContext) interface{} + // Visit a parse tree produced by Query#selectFilterExpr. + VisitSelectFilterExpr(ctx *SelectFilterExprContext) interface{} + // Visit a parse tree produced by Query#repStmt. VisitRepStmt(ctx *RepStmtContext) interface{} diff --git a/netmap/policy.go b/netmap/policy.go index 323050e..d706556 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -560,6 +560,44 @@ func (p *PlacementPolicy) DecodeString(s string) error { return nil } +// SelectFilterExpr is an expression containing only selectors and filters. +// It's useful to evaluate their effect before being used in a policy. +type SelectFilterExpr struct { + cbf uint32 + selector *netmap.Selector + filters []netmap.Filter +} + +// DecodeString decodes a string into a SelectFilterExpr. +// Returns an error if s is malformed. +func DecodeSelectFilterString(s string) (*SelectFilterExpr, error) { + var v policyVisitor + + input := antlr.NewInputStream(s) + lexer := parser.NewQueryLexer(input) + lexer.RemoveErrorListeners() + lexer.AddErrorListener(&v) + stream := antlr.NewCommonTokenStream(lexer, 0) + + pp := parser.NewQuery(stream) + pp.BuildParseTrees = true + + pp.RemoveErrorListeners() + pp.AddErrorListener(&v) + sfExpr := pp.SelectFilterExpr().Accept(&v) + + if len(v.errors) != 0 { + return nil, v.errors[0] + } + + parsed, ok := sfExpr.(*SelectFilterExpr) + if !ok { + return nil, fmt.Errorf("unexpected parsed instance type %T", sfExpr) + } + + return parsed, nil +} + var ( // errUnknownFilter is returned when a value of FROM in a query is unknown. errUnknownFilter = errors.New("filter not found") @@ -636,6 +674,39 @@ func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) any { return pl } +func (p *policyVisitor) VisitSelectFilterExpr(ctx *parser.SelectFilterExprContext) any { + if len(p.errors) != 0 { + return nil + } + + sfExpr := new(SelectFilterExpr) + + if cbfStmt := ctx.CbfStmt(); cbfStmt != nil { + cbf, ok := cbfStmt.(*parser.CbfStmtContext).Accept(p).(uint32) + if !ok { + return nil + } + sfExpr.cbf = cbf + } + + if selStmt := ctx.SelectStmt(); selStmt != nil { + sel, ok := selStmt.Accept(p).(*netmap.Selector) + if !ok { + return nil + } + sfExpr.selector = sel + } + + filtStmts := ctx.AllFilterStmt() + sfExpr.filters = make([]netmap.Filter, 0, len(filtStmts)) + + for _, f := range filtStmts { + sfExpr.filters = append(sfExpr.filters, *f.Accept(p).(*netmap.Filter)) + } + + return sfExpr +} + func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) any { cbf, err := strconv.ParseUint(ctx.GetBackupFactor().GetText(), 10, 32) if err != nil { diff --git a/netmap/policy_test.go b/netmap/policy_test.go index 98ce5f2..f954eec 100644 --- a/netmap/policy_test.go +++ b/netmap/policy_test.go @@ -78,3 +78,28 @@ func TestPlacementPolicyEncoding(t *testing.T) { require.Equal(t, v, v2) }) } + +func TestDecodeSelectFilterExpr(t *testing.T) { + for _, s := range []string{ + "SELECT 1 FROM *", + "FILTER Color EQ 'Red' AS RedNode", + ` + FILTER Color EQ 'Red' AS RedNode + FILTER @RedNode AND Shape EQ 'Cirle' AS RedCircleNode + `, + ` + SELECT 1 FROM RedCircleNode + FILTER Color EQ 'Red' AS RedNode + FILTER @RedNode AND Shape EQ 'Cirle' AS RedCircleNode + `, + ` + CBF 1 + SELECT 1 FROM RedCircleNode + FILTER Color EQ 'Red' AS RedNode + FILTER @RedNode AND Shape EQ 'Cirle' AS RedCircleNode + `, + } { + _, err := DecodeSelectFilterString(s) + require.NoError(t, err) + } +} From fb05f7dc5ea44bc555de97d3cede75dc7f4b6fbd Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Tue, 11 Jul 2023 15:23:35 +0300 Subject: [PATCH 051/323] [#112] Add basic documentation for placement policies Signed-off-by: Alejandro Lopez --- doc/image/filter_illustration.svg | 4 + doc/image/placement_policy.svg | 4 + doc/image/rep_illustration.svg | 4 + doc/image/sample_netmap.svg | 4 + doc/image/select_illustration.svg | 4 + doc/policy.md | 445 ++++++++++++++++++++++++++++++ 6 files changed, 465 insertions(+) create mode 100644 doc/image/filter_illustration.svg create mode 100644 doc/image/placement_policy.svg create mode 100644 doc/image/rep_illustration.svg create mode 100644 doc/image/sample_netmap.svg create mode 100644 doc/image/select_illustration.svg create mode 100644 doc/policy.md diff --git a/doc/image/filter_illustration.svg b/doc/image/filter_illustration.svg new file mode 100644 index 0000000..a57aa68 --- /dev/null +++ b/doc/image/filter_illustration.svg @@ -0,0 +1,4 @@ + + + +
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
*
*
MyNodes
MyNodes
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/image/placement_policy.svg b/doc/image/placement_policy.svg new file mode 100644 index 0000000..9cc8a1a --- /dev/null +++ b/doc/image/placement_policy.svg @@ -0,0 +1,4 @@ + + + +
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
SELECT
SELECT
SELECT
SELECT
SELECT
SELECT
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
REP
REP
REP
REP
REP
REP
netmap
netmap
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/image/rep_illustration.svg b/doc/image/rep_illustration.svg new file mode 100644 index 0000000..8bcc327 --- /dev/null +++ b/doc/image/rep_illustration.svg @@ -0,0 +1,4 @@ + + + +
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
REP 1 IN MyNodes
REP 1 IN MyNodes
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/image/sample_netmap.svg b/doc/image/sample_netmap.svg new file mode 100644 index 0000000..3d0b39f --- /dev/null +++ b/doc/image/sample_netmap.svg @@ -0,0 +1,4 @@ + + + +
C
C
A
A
Netmap
Netmap
B
B
D
D
E
E
F
F
G
G
H
H
I
I
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/image/select_illustration.svg b/doc/image/select_illustration.svg new file mode 100644 index 0000000..3a0956a --- /dev/null +++ b/doc/image/select_illustration.svg @@ -0,0 +1,4 @@ + + + +
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
RedOrBlueNodes
RedOrBlueNodes
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/policy.md b/doc/policy.md new file mode 100644 index 0000000..6818468 --- /dev/null +++ b/doc/policy.md @@ -0,0 +1,445 @@ +# Placement Policy + +This document describes placement policies, their purpose, syntax and semantics. + +## Index + +- [Introduction](#introduction) +- [Operations](#operations) + - [Basic Expressions](#basic-expressions) + - [`FILTER`](#filter) + - [`SELECT`](#select) + - [`REP`](#rep) +- [Policies](#policies) + - [The policy playground](#the-policy-playground) + - [`CBF`](#cbf) + - [`UNIQUE`](#unique) + - [More examples](#more-examples) +- [Appendix 1: Operators](#appendix-1-operators) +- [Appendix 2: Policy playground commands](#appendix-2-policy-playground-commands) + +## Introduction + +The purpose of a **placement policy** is to determine whichs node(s) of a frostfs system will store an object. Namely, given a **netmap** (a set of nodes) and a placement policy, a subset of those nodes is selected to store a given object. An important aspect is that since nodes in a netmap come and go due to distributed nature of the system, this selection must be deterministic and consistent, i.e. different nodes must come to the same conclusion as long as they share the same view of the netmap. + +> ℹ️ Throughout this document, we will consider each node as a dictionary of attributes and a global unique ID. + +One way to think about the placement policy, is as a pipeline of operations which begins with a set of nodes (the entire netmap) and gradually refine it into only the nodes that will be in charge of storing the object. More specifically, each operation in this pipeline takes a set of nodes and transforms it into a subset of those nodes. The transformation is done purely on the basis of the node attributes. + +![Placement policy as a pipeline](./image/placement_policy.svg) + +The three main operations are: +1. `FILTER`: filters a set of nodes based on their attributes. +2. `SELECT`: selects a specific amount of nodes from a set of nodes based on certain conditions. +3. `REP`: specifies how many nodes (and which ones) from a set of nodes are used to store an object. + +In the next sections, we will explore each of them in detail. + +## Operations + +### Basic Expressions + +Before exploring the operations in detail, we must get acquainted with the basic expressions that appear in a placement policy. As mentioned above, the placement policy operates solely on the basis of node attributes, and as such, basic expressions mostly revolve around node attribute comparison. + +A comparison expression expresses whether a node attribute equals a specified value: +``` +AttributeName Operation AttributeValue +``` + +For example, the following expression +```sql +City EQ 'Moscow' +``` +asserts that the node attribute `City` equals the value `Moscow`. + +Comparison expressions can be nested via boolean operators and parentheses. For example, the following expression: +```sql +(City EQ 'Moscow') AND (Disks GT 2) +``` +asserts that the node attribute `City` equals the value `Moscow` and the node attribute `Disks` must be greater than `2`. Note that the arguments can be either a string or a number. + +See [Appendix 1](#appendix-1-operators) for a complete list of supported operators. + +### `FILTER` + +A `FILTER` operation takes as input a set of nodes and returns a subset of those nodes. It's useful for selecting nodes that have (or lack) specific attributes. Its basic syntax is as follows: +```bnf +FILTER AS +``` + +For example, the following filter +```sql +FILTER Color EQ 'Red' AS RedNodes +``` +selects those nodes for which the `Color` attribute equals `Red`, and discards the rest. The filter's identifier is `RedNodes`, which can be used to reference it in other parts of the placement policy. For example, you could reference the above filter in another filter as follows +```sql +FILTER @RedNodes AND (City EQ 'Moscow') AS RedMoscowNodes +``` +which would select those nodes for which the `Color` attribute equals `Red` and the `City` attribute equals `Moscow`. You can think of the `@` operator as embedding the referenced filter expression verbatim where it's used. This makes it easy to compose filters. However, filters can be referenced via `@` only within filter expressions. In other places you can simply use the filter identifier directly. + +> ⚠️ Every filter requires a unique identifier. What would be the use of a filter that you cannot reference? + +The following diagram illustrates the filter operation + +![FILTER](./image/filter_illustration.svg) + +where the nodes are represented as colored circles, with their color representing the value of their `Color` attribute, respectively. + +> ℹ️ A filter referring to all nodes in the netmap always exists and can be referenced by `*`. + +### `SELECT` + +A `SELECT` operation specifies how many and which nodes from a subset previously obtained from a `FILTER` will be available to build replica groups for object storage. It's not that different from a `FILTER` in that it transforms a set of nodes into a subset of those, but while a `FILTER` cannot control the size of the resulting subset and other characteristics, a `SELECT` can. + +Its basic syntax is as follows: +```bnf +SELECT {IN (SAME|DISTINCT) } FROM {AS } +``` + +In a nutshell, a `SELECT` takes a filter result as input and outputs a specific number of nodes, optionally enforcing that all output nodes must either share or differ in a specific attribute. Note that only the output node count and the source filter are required. + +Let's see some examples +```sql +-- Selects exactly one node from the entire netmap +SELECT 1 FROM * + +-- Same as above, but with an identifier for the selection +SELECT 1 FROM * AS ONE + +-- Selects two nodes from the RedOrBlueNodes filter, such that both selected nodes +-- share the same value for the Color attribute, i.e. both red or both blue. +SELECT 2 IN SAME Color FROM RedOrBlueNodes + +-- Selects two nodes from the RedOrBlueNodes filter, such that the selected nodes +-- have distinct values for the Color attribute, i.e. one red and one blue. +-- The selection is also given an identifier. +SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes +``` + +The last example is illustrated in the following diagram: + +![SELECT](./image/select_illustration.svg) + +> ℹ️ At this point, notice that while `FILTER`'s output is always unique (namely, every node in the input is either filtered in or out), that is not always the case for `SELECT`. In the last example above, there is more than one way to select two nodes with distinct `Color` attribute. Because we require the output to be deterministic and consistent (so that all nodes agree on which nodes to store a given object without having to commmunicate with each other), we need a way to reach this consensus efficiently. Internally, the policy engine uses [Rendezvouz Hashing](https://en.wikipedia.org/wiki/Rendezvous_hashing) to ensure this. If you want more control over what nodes are actually selected, you can always use narrower filters/selections to ensure this. + +### `REP` + +A `REP` operation specifies how many copies of an object need to be stored (`REP` stands for "replica"). A placement policy can contain multiple replica operations, with each of them representing a replica group, i.e. a group of objects associated with the same replica. Following our analogy with a pipeline, `REP` operations are the sink or output nodes. + +Its basic syntax is as follows: +```bnf +REP {IN * * +``` + +We begin by stating all our `REP` operations, followed by all the `SELECT` operations and finally all the `FILTER` operations. Note that this is the reverse order in which they are applied. Also note that at least one `REP` operation is required. + +Here's a complete example: +```sql +REP 1 IN MyNodes +SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes +FILTER Color EQ 'Red' AS RedNodes +FILTER Color EQ 'Blue' AS BlueNodes +FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes +``` + +In additional to this basic syntax, there are a couple of additional useful options to specify which nodes and how many nodes are actually selected to store objects. We explore these in the next sections. + +### The policy playground + +> ℹ️ This section assumes you have an up-to-date version of the `frostfs-cli`. + +While simple placement policies have predictable results that can be understood at a glance, more complex ones need careful consideration before deployment. In order to simplify understanding a policy's outcome and experimenting while learning, a builtin tool is provided as part of the `frostfs-cli` for this purpose: the policy playground. + +For the remainder of this guide, we will use the policy playground to setup a virtual netmap (that is, one that doesn't require any networking or deployment) and test various policies. In order to visualize this netmap easily, each node will have three attributes: a character, a shape and a color + +![Sample Netmap](./image/sample_netmap.svg) + +We can start the policy playground as follows: +```sh +$ frostfs-cli container policy-playground +> +``` + +Since we didn't pass any endpoint, the initial netmap is empty, which we can verify with the `ls` command (to list the nodes in the netmap): +```sh +> ls +> +``` + +Nows let's add virtual nodes to represent our test netmap in the figure above +```sh +> add 01 Char:A Shape:Circle Color:Blue +> add 02 Char:B Shape:Circle Color:Green +> add 03 Char:C Shape:Circle Color:Red +> add 04 Char:D Shape:Square Color:Blue +> add 05 Char:E Shape:Square Color:Green +> add 06 Char:F Shape:Square Color:Red +> add 07 Char:G Shape:Diamond Color:Blue +> add 08 Char:H Shape:Diamond Color:Green +> add 09 Char:I Shape:Diamond Color:Red +``` + +and verify that the netmap now contains what we expect +```sh +> ls + 1: id=06 attrs={Char:F Shape:Square Color:Red} + 2: id=08 attrs={Char:H Shape:Diamond Color:Green} + 3: id=01 attrs={Char:A Shape:Circle Color:Blue} + 4: id=04 attrs={Char:D Shape:Square Color:Blue} + 5: id=05 attrs={Char:E Shape:Square Color:Green} + 6: id=09 attrs={Char:I Shape:Diamond Color:Red} + 7: id=02 attrs={Char:B Shape:Circle Color:Green} + 8: id=03 attrs={Char:C Shape:Circle Color:Red} + 9: id=07 attrs={Char:G Shape:Diamond Color:Blue} +``` + +With our sample netmap setup, we can now continue. + +### `CBF` + +Consider the following policy: + +```sql +REP 1 +``` + +It builds a replica consisting of one copy, selected from the entire netmap. If we evaluate this policy in our sample netmap, we obtain a result which is probably unexpected: + +```sh +> eval REP 1 + 1: [06 05 02] +``` + +The `eval` commands evaluates a policy and lists in a separate line the nodes selected for each `REP` operation, in the order they appear in the policy. We were expecting a single node, but we got three instead. The reason is that there's a policy-wide parameter called **container backup factor** (or CBF). This parameter is a multiplier which controls the maximum number of storage nodes: for example, if a policy requires 10 nodes and the CBF is 3, it means that the policy can store an object in up to 10 × 3 nodes. However, if there are not enough nodes and fewer (but at least 10) are used, this is not considered an error. + +The default value for CBF is `3`, which explains our result above, given than every node in the netmap agrees with the policy. The CBF can be explicitly set in the policy right after the `REP` operations. For example + +```sh +> eval REP 1 CBF 1 + 1: [06] +``` + +results in what we expected in the first example. On the other hand + +```sh +> eval REP 1 IN MyNodes SELECT 1 IN SAME Char FROM * AS MyNodes + 1: [01] +``` + +results in a single node despite the default CBF, because there are not enough nodes compatible with the selection. + +### `UNIQUE` + +Consider the following policy: +```sql +REP 1 +REP 1 +CBF 2 +``` + +If we evaluate it +```sh +> eval REP 1 REP 1 CBF 2 + 1: [06 05] + 2: [06 05] +``` + +we find that each replica gets two nodes, in accordance with the CBF. However, these nodes are exactly the same and this might not be desirable. In order to force the policy engine to select different nodes for each replica, we can use the `UNIQUE` option, which is specified right before the `REP` operations. + +In our example, if we change it to +```sql +UNIQUE +REP 1 +REP 1 +CBF 2 +``` + +and evaluate it + +```sh +> eval UNIQUE REP 1 REP 1 CBF 2 + 1: [06 05] + 2: [02 03] +``` + +we now find that the nodes selected for each replica are now distinct from each other. + +### More examples + +This section presents some more examples of placement policies and their result when applied to the sample netmap. Try to figure out the result before looking at it or evaluating the policy. + +#### Example #1 +```sql +REP 1 IN TwoRedNodes +SELECT 2 FROM RedNodes AS TwoRedNodes +FILTER Color EQ 'Red' AS RedNodes +``` + +
+Result + +```sh +> eval REP 1 IN TwoRedNodes SELECT 2 FROM RedNodes AS TwoRedNodes FILTER Color EQ 'Red' AS RedNodes + 1: [06 09 03] +``` + +
+ +#### Example #2 +```sql +REP 1 IN TwoRedNodes +REP 1 IN TwoRedNodes +SELECT 2 FROM RedNodes AS TwoRedNodes +FILTER Color EQ 'Red' AS RedNodes +``` + +
+Result + +```sh +> eval REP 1 REP 1 IN TwoRedNodes SELECT 2 FROM RedNodes AS TwoRedNodes FILTER Color EQ 'Red' AS RedNodes + 1: [06 09 03] + 2: [06 09 03] +``` + +
+ +#### Example #3 +```sql +REP 2 IN MyNodes +REP 2 IN MyNodes +SELECT 2 FROM RedOrBlueNodes AS MyNodes +FILTER Color EQ 'Red' AS RedNodes +FILTER Color EQ 'Blue' AS BlueNodes +FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes +``` + +
+Result + +```sh +> eval REP 2 IN MyNodes REP 2 IN MyNodes SELECT 2 FROM RedOrBlueNodes AS MyNodes FILTER Color EQ 'Red' AS RedNodes FILTER Color EQ 'Blue' AS BlueNodes FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes + 1: [06 01 04 03 09 07] + 2: [06 01 04 03 09 07] +``` + +
+ +#### Example #4 +```sql +REP 2 IN MyRedNodes +REP 2 IN MyBlueNodes +CBF 1 +SELECT 2 FROM RedNodes AS MyRedNodes +SELECT 2 FROM BlueNodes AS MyBlueNodes +FILTER Color EQ 'Red' AS RedNodes +FILTER Color EQ 'Blue' AS BlueNodes +``` + +
+Result + +```sh +> eval REP 2 IN MyRedNodes REP 2 IN MyBlueNodes CBF 1 SELECT 2 FROM RedNodes AS MyRedNodes SELECT 2 FROM BlueNodes AS MyBlueNodes FILTER Color EQ 'Red' AS RedNodes FILTER Color EQ 'Blue' AS BlueNodes + 1: [06 03] + 2: [01 04] +``` + +
+ +#### Example #5 +```sql +UNIQUE +REP 1 IN MyGreenNodes +REP 1 IN MyGreenNodes +REP 1 IN MyGreenNodes +CBF 1 +SELECT 1 FROM GreenNodes AS MyGreenNodes +FILTER Color EQ 'Green' AS GreenNodes +``` + +
+Result + +```sh +> eval UNIQUE REP 1 IN MyGreenNodes REP 1 IN MyGreenNodes REP 1 IN MyGreenNodes CBF 1 SELECT 1 FROM GreenNodes AS MyGreenNodes FILTER Color EQ 'Green' AS GreenNodes + 1: [05] + 2: [02] + 3: [08] +``` + +
+ +#### Example #6 +```sql +REP 1 IN MyNodes +REP 2 +CBF 2 +SELECT 1 FROM CuteNodes AS MyNodes +FILTER (Color EQ 'Blue') AND NOT (Shape EQ 'Circle' OR Shape EQ 'Square') AS CuteNodes +``` + +
+Result + +```sh +eval REP 1 IN MyNodes REP 2 CBF 2 SELECT 1 FROM CuteNodes AS MyNodes FILTER (Color EQ 'Blue') AND NOT (Shape EQ 'Circle' OR Shape EQ 'Square') AS CuteNodes + 1: [07] + 2: [06 05 02 03] +``` + +
+ +## Appendix 1: Operators + +Comparison operators (all binary): +- `EQ`: equals +- `NE`: not equal +- `GE`: greater or equal +- `GT`: greater than +- `LE`: less or equal +- `LT`: less than + +Logical operators: +- `NOT`: negation (unary) +- `AND`: conjunction (binary) +- `OR`: disjunction (binary) + +Others: +- `@`: filter reference +- `(`: left parenthesis +- `)`: right parenthesis + +## Appendix 2: Policy playground commands + +- `ls`: list nodes in the current netmap and their attributes +- `add`: add a node to the current netmap. If it already exists, it will be overwritten. +- `remove`: remove a node from the current netmap. +- `eval`: evaluate a placement policy on the current netmap. \ No newline at end of file From 5defed4ab43591f6a2d3247237382b0ef7829fd7 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 19 Jul 2023 15:19:04 +0300 Subject: [PATCH 052/323] [#126] go.mod: Update frostfs-api-go package version Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fc96fa4..5a0836f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.19 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230719100335-582d94c81c74 git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 diff --git a/go.sum b/go.sum index 11f92d0..bcf3c82 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe h1:SB102RiEg+4h9qcwyG97zHBtwduMRbedbtkwRDVSps8= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230719100335-582d94c81c74 h1:xgeSzZP40SbMMVGfG1V7xrC8m7DS6llZ9kkjO9L8+jY= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230719100335-582d94c81c74/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= From ecb1fef78cfc92573f42938cd2ae575f7f49008e Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 14:38:43 +0300 Subject: [PATCH 053/323] [#129] client: Do not override error status WriteObject() Here is a scenario: 1. `resolveFrostFSErrors` is false. 2. The first object part was not written, which was signified in status. 3. The second part was written correctly. Client now thinks that the object is written even though it was not. In theory we could also return only status, but client-side splitting is not a single RPC, so it makes sense. Signed-off-by: Evgenii Stratonikov --- client/object_put_transformer.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/object_put_transformer.go b/client/object_put_transformer.go index ad8165d..402ad00 100644 --- a/client/object_put_transformer.go +++ b/client/object_put_transformer.go @@ -3,6 +3,7 @@ package client import ( "context" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" "google.golang.org/grpc/codes" @@ -82,6 +83,9 @@ func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) err wrt.WritePayloadChunk(ctx, o.Payload()) } it.res, err = wrt.Close(ctx) + if err == nil && !it.client.prm.resolveFrostFSErrors && !apistatus.IsSuccessful(it.res.st) { + err = apistatus.ErrFromStatus(it.res.st) + } return err } @@ -106,6 +110,10 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b statusRes: res.statusRes, obj: id, } + if !it.client.prm.resolveFrostFSErrors && !apistatus.IsSuccessful(it.res.st) { + return true, apistatus.ErrFromStatus(it.res.st) + } + return true, nil } return true, err } From 0886d800838fc9877446cffceefeb42cfd31c45a Mon Sep 17 00:00:00 2001 From: Marina Biryukova Date: Fri, 28 Jul 2023 18:35:35 +0300 Subject: [PATCH 054/323] [#69] Add close for nns.Dial Signed-off-by: Marina Biryukova --- ns/nns.go | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/ns/nns.go b/ns/nns.go index 4af72f4..947e8fa 100644 --- a/ns/nns.go +++ b/ns/nns.go @@ -19,12 +19,25 @@ import ( "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" ) +// multiSchemeClient unites invoker.RPCInvoke and common interface of +// rpcclient.Client and rpcclient.WSClient. +type multiSchemeClient interface { + invoker.RPCInvoke + // Init turns client to "ready-to-work" state. + Init() error + // Close closes connections. + Close() + // GetContractStateByID returns state of the NNS contract on 1 input. + GetContractStateByID(int32) (*state.Contract, error) +} + // NNS looks up FrostFS names using Neo Name Service. // // Instances are created with a variable declaration. Before work, the connection // to the NNS server MUST be established using Dial method. type NNS struct { nnsContract util.Uint160 + client multiSchemeClient invoker interface { Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error) @@ -37,47 +50,41 @@ type NNS struct { // If URL address scheme is 'ws' or 'wss', then WebSocket protocol is used, // otherwise HTTP. func (n *NNS) Dial(address string) error { - // multiSchemeClient unites invoker.RPCInvoke and common interface of - // rpcclient.Client and rpcclient.WSClient. Interface is anonymous - // according to assumption that common interface of these client types - // is not required by design and may diverge with changes. - var multiSchemeClient interface { - invoker.RPCInvoke - // Init turns client to "ready-to-work" state. - Init() error - // GetContractStateByID returns state of the NNS contract on 1 input. - GetContractStateByID(int32) (*state.Contract, error) - } var err error uri, err := url.Parse(address) if err == nil && (uri.Scheme == "ws" || uri.Scheme == "wss") { - multiSchemeClient, err = rpcclient.NewWS(context.Background(), address, rpcclient.WSOptions{}) + n.client, err = rpcclient.NewWS(context.Background(), address, rpcclient.WSOptions{}) if err != nil { return fmt.Errorf("create Neo WebSocket client: %w", err) } } else { - multiSchemeClient, err = rpcclient.New(context.Background(), address, rpcclient.Options{}) + n.client, err = rpcclient.New(context.Background(), address, rpcclient.Options{}) if err != nil { return fmt.Errorf("create Neo HTTP client: %w", err) } } - if err = multiSchemeClient.Init(); err != nil { + if err = n.client.Init(); err != nil { return fmt.Errorf("initialize Neo client: %w", err) } - nnsContract, err := multiSchemeClient.GetContractStateByID(1) + nnsContract, err := n.client.GetContractStateByID(1) if err != nil { return fmt.Errorf("get NNS contract state: %w", err) } - n.invoker = invoker.New(multiSchemeClient, nil) + n.invoker = invoker.New(n.client, nil) n.nnsContract = nnsContract.Hash return nil } +// Close closes connections of multiSchemeClient. +func (n *NNS) Close() { + n.client.Close() +} + // ResolveContainerDomain looks up for NNS TXT records for the given container domain // by calling `resolve` method of NNS contract. Returns the first record which represents // valid container ID in a string format. Otherwise, returns an error. From 78d1439b2c71df535ad06f3c6d35c6b72862e6b8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 27 Jul 2023 19:44:44 +0300 Subject: [PATCH 055/323] [#133] go.mod: Update api-go Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5a0836f..c628456 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.19 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230719100335-582d94c81c74 + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230726155259-7a5ee927c8a2 git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 diff --git a/go.sum b/go.sum index bcf3c82..443bcbd 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230719100335-582d94c81c74 h1:xgeSzZP40SbMMVGfG1V7xrC8m7DS6llZ9kkjO9L8+jY= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230719100335-582d94c81c74/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230726155259-7a5ee927c8a2 h1:5QUnWafFc0RprHCpQ3d1T4MEo2fvGjL/3GPeB0w54mA= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230726155259-7a5ee927c8a2/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= From 0fe0d716784b4412f2711274f1c379de6bd15c16 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 27 Jul 2023 19:47:18 +0300 Subject: [PATCH 056/323] [#133] .forgejo: Add names to actions Signed-off-by: Evgenii Stratonikov --- .forgejo/workflows/dco.yml | 1 + .forgejo/workflows/tests.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml index 682855b..d77461c 100644 --- a/.forgejo/workflows/dco.yml +++ b/.forgejo/workflows/dco.yml @@ -1,3 +1,4 @@ +name: DCO on: [pull_request] jobs: diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index e457cba..664767b 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -1,3 +1,4 @@ +name: Tests and linters on: [pull_request] jobs: From 18a9e4bceb671c2a7235ca1107b10c41695ee840 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 24 Jul 2023 14:29:31 +0300 Subject: [PATCH 057/323] [#121] client: Make PrmContainerPut struct fields public Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/common.go | 1 + client/container_put.go | 35 ++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/client/common.go b/client/common.go index 1d56130..7449288 100644 --- a/client/common.go +++ b/client/common.go @@ -82,6 +82,7 @@ var ( errorMissingAnnouncements = errors.New("missing announcements") errorZeroRangeLength = errors.New("zero range length") errorMissingRanges = errors.New("missing ranges") + errorInvalidXHeaders = errors.New("xheaders must be presented only as key-value pairs") ) // groups all the details required to send a single request and process a response to it. diff --git a/client/container_put.go b/client/container_put.go index 630d265..ebf90e8 100644 --- a/client/container_put.go +++ b/client/container_put.go @@ -19,20 +19,20 @@ import ( // PrmContainerPut groups parameters of ContainerPut operation. type PrmContainerPut struct { - prmCommonMeta + // FrostFS request X-Headers + XHeaders []string - cnrSet bool - cnr container.Container + Container *container.Container - sessionSet bool - session session.Container + Session *session.Container } // SetContainer sets structured information about new FrostFS container. // Required parameter. +// +// NOTE: method is deprecated func (x *PrmContainerPut) SetContainer(cnr container.Container) { - x.cnr = cnr - x.cnrSet = true + x.Container = &cnr } // WithinSession specifies session within which container should be saved. @@ -43,23 +43,28 @@ func (x *PrmContainerPut) SetContainer(cnr container.Container) { // Session is optional, if set the following requirements apply: // - session operation MUST be session.VerbContainerPut (ForVerb) // - token MUST be signed using private key of the owner of the container to be saved +// +// NOTE: method is deprecated func (x *PrmContainerPut) WithinSession(s session.Container) { - x.session = s - x.sessionSet = true + x.Session = &s } func (x *PrmContainerPut) buildRequest(c *Client) (*v2container.PutRequest, error) { - if !x.cnrSet { + if x.Container == nil { return nil, errorMissingContainer } + if len(x.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + // TODO: check private key is set before forming the request var cnr v2container.Container - x.cnr.WriteToV2(&cnr) + x.Container.WriteToV2(&cnr) var sig frostfscrypto.Signature - err := container.CalculateSignature(&sig, x.cnr, c.prm.key) + err := container.CalculateSignature(&sig, *x.Container, c.prm.key) if err != nil { return nil, fmt.Errorf("calculate container signature: %w", err) } @@ -72,11 +77,11 @@ func (x *PrmContainerPut) buildRequest(c *Client) (*v2container.PutRequest, erro reqBody.SetSignature(&sigv2) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.prmCommonMeta.xHeaders, &meta) + writeXHeadersToMeta(x.XHeaders, &meta) - if x.sessionSet { + if x.Session != nil { var tokv2 v2session.Token - x.session.WriteToV2(&tokv2) + x.Session.WriteToV2(&tokv2) meta.SetSessionToken(&tokv2) } From 13d0b170d2ad49325b08f2b79a8ef7411561ef16 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 31 Jul 2023 14:08:50 +0300 Subject: [PATCH 058/323] [#121] client: Make pool PrmContainerPut struct fields public Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_put.go | 4 ++-- pool/pool.go | 33 ++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/client/container_put.go b/client/container_put.go index ebf90e8..f186abd 100644 --- a/client/container_put.go +++ b/client/container_put.go @@ -30,7 +30,7 @@ type PrmContainerPut struct { // SetContainer sets structured information about new FrostFS container. // Required parameter. // -// NOTE: method is deprecated +// Deprecated: Use PrmContainerPut.Container instead. func (x *PrmContainerPut) SetContainer(cnr container.Container) { x.Container = &cnr } @@ -44,7 +44,7 @@ func (x *PrmContainerPut) SetContainer(cnr container.Container) { // - session operation MUST be session.VerbContainerPut (ForVerb) // - token MUST be signed using private key of the owner of the container to be saved // -// NOTE: method is deprecated +// Deprecated: Use PrmContainerPut.Session instead. func (x *PrmContainerPut) WithinSession(s session.Container) { x.Session = &s } diff --git a/pool/pool.go b/pool/pool.go index 2f662d3..04b84aa 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -407,7 +407,7 @@ func (c *clientWrapper) containerPut(ctx context.Context, prm PrmContainerPut) ( } start := time.Now() - res, err := cl.ContainerPut(ctx, prm.prmClient) + res, err := cl.ContainerPut(ctx, prm.ClientParams) c.incRequests(time.Since(start), methodContainerPut) var st apistatus.Status if res != nil { @@ -417,13 +417,13 @@ func (c *clientWrapper) containerPut(ctx context.Context, prm PrmContainerPut) ( return cid.ID{}, fmt.Errorf("container put on client: %w", err) } - if !prm.waitParamsSet { - prm.waitParams.setDefaults() + if prm.WaitParams == nil { + prm.WaitParams = defaultWaitParams() } idCnr := res.ID() - err = waitForContainerPresence(ctx, c, idCnr, &prm.waitParams) + err = waitForContainerPresence(ctx, c, idCnr, prm.WaitParams) if err = c.handleError(ctx, nil, err); err != nil { return cid.ID{}, fmt.Errorf("wait container presence on client: %w", err) } @@ -1221,6 +1221,13 @@ func (x *WaitParams) setDefaults() { x.pollInterval = 5 * time.Second } +func defaultWaitParams() *WaitParams { + return &WaitParams{ + timeout: 120 * time.Second, + pollInterval: 5 * time.Second, + } +} + // checkForPositive panics if any of the wait params isn't positive. func (x *WaitParams) checkForPositive() { if x.timeout <= 0 || x.pollInterval <= 0 { @@ -1400,35 +1407,39 @@ func (x *PrmObjectSearch) SetFilters(filters object.SearchFilters) { // PrmContainerPut groups parameters of PutContainer operation. type PrmContainerPut struct { - prmClient sdkClient.PrmContainerPut + ClientParams sdkClient.PrmContainerPut - waitParams WaitParams - waitParamsSet bool + WaitParams *WaitParams } // SetContainer container structure to be used as a parameter of the base // client's operation. // // See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerPut.SetContainer. +// +// Deprecated: Use PrmContainerPut.ClientParams.Container instead. func (x *PrmContainerPut) SetContainer(cnr container.Container) { - x.prmClient.SetContainer(cnr) + x.ClientParams.SetContainer(cnr) } // WithinSession specifies session to be used as a parameter of the base // client's operation. // // See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerPut.WithinSession. +// +// Deprecated: Use PrmContainerPut.ClientParams.Session instead. func (x *PrmContainerPut) WithinSession(s session.Container) { - x.prmClient.WithinSession(s) + x.ClientParams.WithinSession(s) } // SetWaitParams specifies timeout params to complete operation. // If not provided the default one will be used. // Panics if any of the wait params isn't positive. +// +// Deprecated: Use PrmContainerPut.ClientParams.WaitParams instead. func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams) { waitParams.checkForPositive() - x.waitParams = waitParams - x.waitParamsSet = true + x.WaitParams = &waitParams } // PrmContainerGet groups parameters of GetContainer operation. From 95b987b818d9af79d01f67f2d0efcf2b3c7f5261 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Aug 2023 11:04:45 +0300 Subject: [PATCH 059/323] [#137] go.mod: Update api-go Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c628456..7c1690e 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.19 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230726155259-7a5ee927c8a2 + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 diff --git a/go.sum b/go.sum index 443bcbd..2f9e78f 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230726155259-7a5ee927c8a2 h1:5QUnWafFc0RprHCpQ3d1T4MEo2fvGjL/3GPeB0w54mA= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230726155259-7a5ee927c8a2/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 h1:v6JqBD/VzZx3QSxbaXnUwnnJ1KEYheU4LzLGr3IhsAE= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= From 363f153eafa601c6ac8d560496a3bf21adffe0ce Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Aug 2023 10:54:37 +0300 Subject: [PATCH 060/323] [#136] pool: Set order field to get subtree With new revision of tree service protocol, getSubTree requires to use explicit order field. Signed-off-by: Alex Vanin --- pool/tree/pool.go | 3 + pool/tree/service/service.pb.go | 703 ++++++++++++++++----------- pool/tree/service/service_grpc.pb.go | 2 +- pool/tree/service/types.pb.go | 2 +- syncTree.sh | 2 +- 5 files changed, 423 insertions(+), 289 deletions(-) diff --git a/pool/tree/pool.go b/pool/tree/pool.go index 7fca21b..a9adb01 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -368,6 +368,9 @@ func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeRe RootId: prm.RootID, Depth: prm.Depth, BearerToken: prm.BearerToken, + OrderBy: &grpcService.GetSubTreeRequest_Body_Order{ + Direction: grpcService.GetSubTreeRequest_Body_Order_Asc, + }, }, } diff --git a/pool/tree/service/service.pb.go b/pool/tree/service/service.pb.go index 08664a6..63f3e71 100644 --- a/pool/tree/service/service.pb.go +++ b/pool/tree/service/service.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.12.4 +// protoc v3.21.9 // source: pkg/services/tree/service.proto package tree @@ -23,6 +23,52 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type GetSubTreeRequest_Body_Order_Direction int32 + +const ( + GetSubTreeRequest_Body_Order_None GetSubTreeRequest_Body_Order_Direction = 0 + GetSubTreeRequest_Body_Order_Asc GetSubTreeRequest_Body_Order_Direction = 1 +) + +// Enum value maps for GetSubTreeRequest_Body_Order_Direction. +var ( + GetSubTreeRequest_Body_Order_Direction_name = map[int32]string{ + 0: "None", + 1: "Asc", + } + GetSubTreeRequest_Body_Order_Direction_value = map[string]int32{ + "None": 0, + "Asc": 1, + } +) + +func (x GetSubTreeRequest_Body_Order_Direction) Enum() *GetSubTreeRequest_Body_Order_Direction { + p := new(GetSubTreeRequest_Body_Order_Direction) + *p = x + return p +} + +func (x GetSubTreeRequest_Body_Order_Direction) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GetSubTreeRequest_Body_Order_Direction) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_services_tree_service_proto_enumTypes[0].Descriptor() +} + +func (GetSubTreeRequest_Body_Order_Direction) Type() protoreflect.EnumType { + return &file_pkg_services_tree_service_proto_enumTypes[0] +} + +func (x GetSubTreeRequest_Body_Order_Direction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GetSubTreeRequest_Body_Order_Direction.Descriptor instead. +func (GetSubTreeRequest_Body_Order_Direction) EnumDescriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{10, 0, 0, 0} +} + type AddRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1940,6 +1986,8 @@ type GetSubTreeRequest_Body struct { Depth uint32 `protobuf:"varint,4,opt,name=depth,proto3" json:"depth,omitempty"` // Bearer token in V2 format. BearerToken []byte `protobuf:"bytes,5,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` + // Result ordering. + OrderBy *GetSubTreeRequest_Body_Order `protobuf:"bytes,6,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` } func (x *GetSubTreeRequest_Body) Reset() { @@ -2009,6 +2057,60 @@ func (x *GetSubTreeRequest_Body) GetBearerToken() []byte { return nil } +func (x *GetSubTreeRequest_Body) GetOrderBy() *GetSubTreeRequest_Body_Order { + if x != nil { + return x.OrderBy + } + return nil +} + +type GetSubTreeRequest_Body_Order struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Direction GetSubTreeRequest_Body_Order_Direction `protobuf:"varint,1,opt,name=direction,proto3,enum=tree.GetSubTreeRequest_Body_Order_Direction" json:"direction,omitempty"` +} + +func (x *GetSubTreeRequest_Body_Order) Reset() { + *x = GetSubTreeRequest_Body_Order{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_tree_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSubTreeRequest_Body_Order) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSubTreeRequest_Body_Order) ProtoMessage() {} + +func (x *GetSubTreeRequest_Body_Order) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_tree_service_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSubTreeRequest_Body_Order.ProtoReflect.Descriptor instead. +func (*GetSubTreeRequest_Body_Order) Descriptor() ([]byte, []int) { + return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{10, 0, 0} +} + +func (x *GetSubTreeRequest_Body_Order) GetDirection() GetSubTreeRequest_Body_Order_Direction { + if x != nil { + return x.Direction + } + return GetSubTreeRequest_Body_Order_None +} + type GetSubTreeResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2027,7 +2129,7 @@ type GetSubTreeResponse_Body struct { func (x *GetSubTreeResponse_Body) Reset() { *x = GetSubTreeResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[32] + mi := &file_pkg_services_tree_service_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2040,7 +2142,7 @@ func (x *GetSubTreeResponse_Body) String() string { func (*GetSubTreeResponse_Body) ProtoMessage() {} func (x *GetSubTreeResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[32] + mi := &file_pkg_services_tree_service_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2096,7 +2198,7 @@ type TreeListRequest_Body struct { func (x *TreeListRequest_Body) Reset() { *x = TreeListRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[33] + mi := &file_pkg_services_tree_service_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2109,7 +2211,7 @@ func (x *TreeListRequest_Body) String() string { func (*TreeListRequest_Body) ProtoMessage() {} func (x *TreeListRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[33] + mi := &file_pkg_services_tree_service_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2144,7 +2246,7 @@ type TreeListResponse_Body struct { func (x *TreeListResponse_Body) Reset() { *x = TreeListResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[34] + mi := &file_pkg_services_tree_service_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2157,7 +2259,7 @@ func (x *TreeListResponse_Body) String() string { func (*TreeListResponse_Body) ProtoMessage() {} func (x *TreeListResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[34] + mi := &file_pkg_services_tree_service_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2196,7 +2298,7 @@ type ApplyRequest_Body struct { func (x *ApplyRequest_Body) Reset() { *x = ApplyRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[35] + mi := &file_pkg_services_tree_service_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2209,7 +2311,7 @@ func (x *ApplyRequest_Body) String() string { func (*ApplyRequest_Body) ProtoMessage() {} func (x *ApplyRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[35] + mi := &file_pkg_services_tree_service_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2255,7 +2357,7 @@ type ApplyResponse_Body struct { func (x *ApplyResponse_Body) Reset() { *x = ApplyResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[36] + mi := &file_pkg_services_tree_service_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2268,7 +2370,7 @@ func (x *ApplyResponse_Body) String() string { func (*ApplyResponse_Body) ProtoMessage() {} func (x *ApplyResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[36] + mi := &file_pkg_services_tree_service_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2302,7 +2404,7 @@ type GetOpLogRequest_Body struct { func (x *GetOpLogRequest_Body) Reset() { *x = GetOpLogRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[37] + mi := &file_pkg_services_tree_service_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2315,7 +2417,7 @@ func (x *GetOpLogRequest_Body) String() string { func (*GetOpLogRequest_Body) ProtoMessage() {} func (x *GetOpLogRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[37] + mi := &file_pkg_services_tree_service_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2371,7 +2473,7 @@ type GetOpLogResponse_Body struct { func (x *GetOpLogResponse_Body) Reset() { *x = GetOpLogResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[38] + mi := &file_pkg_services_tree_service_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2384,7 +2486,7 @@ func (x *GetOpLogResponse_Body) String() string { func (*GetOpLogResponse_Body) ProtoMessage() {} func (x *GetOpLogResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[38] + mi := &file_pkg_services_tree_service_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2416,7 +2518,7 @@ type HealthcheckResponse_Body struct { func (x *HealthcheckResponse_Body) Reset() { *x = HealthcheckResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[39] + mi := &file_pkg_services_tree_service_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2429,7 +2531,7 @@ func (x *HealthcheckResponse_Body) String() string { func (*HealthcheckResponse_Body) ProtoMessage() {} func (x *HealthcheckResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[39] + mi := &file_pkg_services_tree_service_proto_msgTypes[40] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2454,7 +2556,7 @@ type HealthcheckRequest_Body struct { func (x *HealthcheckRequest_Body) Reset() { *x = HealthcheckRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_services_tree_service_proto_msgTypes[40] + mi := &file_pkg_services_tree_service_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2467,7 +2569,7 @@ func (x *HealthcheckRequest_Body) String() string { func (*HealthcheckRequest_Body) ProtoMessage() {} func (x *HealthcheckRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_pkg_services_tree_service_proto_msgTypes[40] + mi := &file_pkg_services_tree_service_proto_msgTypes[41] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2640,14 +2742,14 @@ var file_pkg_services_tree_service_proto_rawDesc = []byte{ 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, - 0x73, 0x22, 0x8b, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, + 0x73, 0x22, 0xbf, 0x03, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x94, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0xc8, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, @@ -2656,146 +2758,157 @@ var file_pkg_services_tree_service_proto_rawDesc = []byte{ 0x72, 0x6f, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, - 0xf6, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, - 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x7e, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x9b, 0x01, 0x0a, 0x0f, 0x54, 0x72, 0x65, - 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x29, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, - 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x18, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xdb, 0x01, 0x0a, 0x0c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x1a, 0x6f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, - 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x72, 0x65, 0x65, - 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe2, 0x01, 0x0a, 0x0f, 0x47, 0x65, - 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x72, - 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, + 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x3d, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, + 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x1a, 0x73, + 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x44, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x1e, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x73, + 0x63, 0x10, 0x01, 0x22, 0xf6, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, + 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x70, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa7, - 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, - 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x33, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2b, 0x0a, 0x09, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x32, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x7e, 0x0a, 0x12, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0xd6, 0x04, 0x0a, 0x0b, - 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x41, - 0x64, 0x64, 0x12, 0x10, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x42, 0x79, - 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, - 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x74, - 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, - 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x4d, 0x6f, - 0x76, 0x65, 0x12, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, 0x76, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x47, 0x65, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1a, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x7e, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, + 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x9b, 0x01, 0x0a, + 0x0f, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, + 0x29, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x10, 0x54, + 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, + 0x18, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xdb, 0x01, 0x0a, 0x0c, 0x41, 0x70, + 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, + 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x6f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x6c, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, + 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe2, 0x01, + 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x1a, 0x70, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, + 0x65, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0xa7, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, + 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x33, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, + 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x80, 0x01, 0x0a, + 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0x7e, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, + 0xd6, 0x04, 0x0a, 0x0b, 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x2a, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x10, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x41, + 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, + 0x0a, 0x04, 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1a, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, + 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, - 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, - 0x65, 0x12, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, - 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x39, 0x0a, 0x08, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, - 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x30, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x12, - 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, - 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, - 0x12, 0x42, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, - 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x74, 0x72, 0x65, 0x65, - 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, - 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x6e, 0x6f, - 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, - 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x75, + 0x62, 0x54, 0x72, 0x65, 0x65, 0x12, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x39, 0x0a, 0x08, 0x54, 0x72, + 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, + 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, + 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x12, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, 0x70, + 0x4c, 0x6f, 0x67, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, + 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, + 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, + 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2810,127 +2923,132 @@ func file_pkg_services_tree_service_proto_rawDescGZIP() []byte { return file_pkg_services_tree_service_proto_rawDescData } -var file_pkg_services_tree_service_proto_msgTypes = make([]protoimpl.MessageInfo, 41) +var file_pkg_services_tree_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_pkg_services_tree_service_proto_msgTypes = make([]protoimpl.MessageInfo, 42) var file_pkg_services_tree_service_proto_goTypes = []interface{}{ - (*AddRequest)(nil), // 0: tree.AddRequest - (*AddResponse)(nil), // 1: tree.AddResponse - (*AddByPathRequest)(nil), // 2: tree.AddByPathRequest - (*AddByPathResponse)(nil), // 3: tree.AddByPathResponse - (*RemoveRequest)(nil), // 4: tree.RemoveRequest - (*RemoveResponse)(nil), // 5: tree.RemoveResponse - (*MoveRequest)(nil), // 6: tree.MoveRequest - (*MoveResponse)(nil), // 7: tree.MoveResponse - (*GetNodeByPathRequest)(nil), // 8: tree.GetNodeByPathRequest - (*GetNodeByPathResponse)(nil), // 9: tree.GetNodeByPathResponse - (*GetSubTreeRequest)(nil), // 10: tree.GetSubTreeRequest - (*GetSubTreeResponse)(nil), // 11: tree.GetSubTreeResponse - (*TreeListRequest)(nil), // 12: tree.TreeListRequest - (*TreeListResponse)(nil), // 13: tree.TreeListResponse - (*ApplyRequest)(nil), // 14: tree.ApplyRequest - (*ApplyResponse)(nil), // 15: tree.ApplyResponse - (*GetOpLogRequest)(nil), // 16: tree.GetOpLogRequest - (*GetOpLogResponse)(nil), // 17: tree.GetOpLogResponse - (*HealthcheckResponse)(nil), // 18: tree.HealthcheckResponse - (*HealthcheckRequest)(nil), // 19: tree.HealthcheckRequest - (*AddRequest_Body)(nil), // 20: tree.AddRequest.Body - (*AddResponse_Body)(nil), // 21: tree.AddResponse.Body - (*AddByPathRequest_Body)(nil), // 22: tree.AddByPathRequest.Body - (*AddByPathResponse_Body)(nil), // 23: tree.AddByPathResponse.Body - (*RemoveRequest_Body)(nil), // 24: tree.RemoveRequest.Body - (*RemoveResponse_Body)(nil), // 25: tree.RemoveResponse.Body - (*MoveRequest_Body)(nil), // 26: tree.MoveRequest.Body - (*MoveResponse_Body)(nil), // 27: tree.MoveResponse.Body - (*GetNodeByPathRequest_Body)(nil), // 28: tree.GetNodeByPathRequest.Body - (*GetNodeByPathResponse_Info)(nil), // 29: tree.GetNodeByPathResponse.Info - (*GetNodeByPathResponse_Body)(nil), // 30: tree.GetNodeByPathResponse.Body - (*GetSubTreeRequest_Body)(nil), // 31: tree.GetSubTreeRequest.Body - (*GetSubTreeResponse_Body)(nil), // 32: tree.GetSubTreeResponse.Body - (*TreeListRequest_Body)(nil), // 33: tree.TreeListRequest.Body - (*TreeListResponse_Body)(nil), // 34: tree.TreeListResponse.Body - (*ApplyRequest_Body)(nil), // 35: tree.ApplyRequest.Body - (*ApplyResponse_Body)(nil), // 36: tree.ApplyResponse.Body - (*GetOpLogRequest_Body)(nil), // 37: tree.GetOpLogRequest.Body - (*GetOpLogResponse_Body)(nil), // 38: tree.GetOpLogResponse.Body - (*HealthcheckResponse_Body)(nil), // 39: tree.HealthcheckResponse.Body - (*HealthcheckRequest_Body)(nil), // 40: tree.HealthcheckRequest.Body - (*Signature)(nil), // 41: tree.Signature - (*KeyValue)(nil), // 42: tree.KeyValue - (*LogMove)(nil), // 43: tree.LogMove + (GetSubTreeRequest_Body_Order_Direction)(0), // 0: tree.GetSubTreeRequest.Body.Order.Direction + (*AddRequest)(nil), // 1: tree.AddRequest + (*AddResponse)(nil), // 2: tree.AddResponse + (*AddByPathRequest)(nil), // 3: tree.AddByPathRequest + (*AddByPathResponse)(nil), // 4: tree.AddByPathResponse + (*RemoveRequest)(nil), // 5: tree.RemoveRequest + (*RemoveResponse)(nil), // 6: tree.RemoveResponse + (*MoveRequest)(nil), // 7: tree.MoveRequest + (*MoveResponse)(nil), // 8: tree.MoveResponse + (*GetNodeByPathRequest)(nil), // 9: tree.GetNodeByPathRequest + (*GetNodeByPathResponse)(nil), // 10: tree.GetNodeByPathResponse + (*GetSubTreeRequest)(nil), // 11: tree.GetSubTreeRequest + (*GetSubTreeResponse)(nil), // 12: tree.GetSubTreeResponse + (*TreeListRequest)(nil), // 13: tree.TreeListRequest + (*TreeListResponse)(nil), // 14: tree.TreeListResponse + (*ApplyRequest)(nil), // 15: tree.ApplyRequest + (*ApplyResponse)(nil), // 16: tree.ApplyResponse + (*GetOpLogRequest)(nil), // 17: tree.GetOpLogRequest + (*GetOpLogResponse)(nil), // 18: tree.GetOpLogResponse + (*HealthcheckResponse)(nil), // 19: tree.HealthcheckResponse + (*HealthcheckRequest)(nil), // 20: tree.HealthcheckRequest + (*AddRequest_Body)(nil), // 21: tree.AddRequest.Body + (*AddResponse_Body)(nil), // 22: tree.AddResponse.Body + (*AddByPathRequest_Body)(nil), // 23: tree.AddByPathRequest.Body + (*AddByPathResponse_Body)(nil), // 24: tree.AddByPathResponse.Body + (*RemoveRequest_Body)(nil), // 25: tree.RemoveRequest.Body + (*RemoveResponse_Body)(nil), // 26: tree.RemoveResponse.Body + (*MoveRequest_Body)(nil), // 27: tree.MoveRequest.Body + (*MoveResponse_Body)(nil), // 28: tree.MoveResponse.Body + (*GetNodeByPathRequest_Body)(nil), // 29: tree.GetNodeByPathRequest.Body + (*GetNodeByPathResponse_Info)(nil), // 30: tree.GetNodeByPathResponse.Info + (*GetNodeByPathResponse_Body)(nil), // 31: tree.GetNodeByPathResponse.Body + (*GetSubTreeRequest_Body)(nil), // 32: tree.GetSubTreeRequest.Body + (*GetSubTreeRequest_Body_Order)(nil), // 33: tree.GetSubTreeRequest.Body.Order + (*GetSubTreeResponse_Body)(nil), // 34: tree.GetSubTreeResponse.Body + (*TreeListRequest_Body)(nil), // 35: tree.TreeListRequest.Body + (*TreeListResponse_Body)(nil), // 36: tree.TreeListResponse.Body + (*ApplyRequest_Body)(nil), // 37: tree.ApplyRequest.Body + (*ApplyResponse_Body)(nil), // 38: tree.ApplyResponse.Body + (*GetOpLogRequest_Body)(nil), // 39: tree.GetOpLogRequest.Body + (*GetOpLogResponse_Body)(nil), // 40: tree.GetOpLogResponse.Body + (*HealthcheckResponse_Body)(nil), // 41: tree.HealthcheckResponse.Body + (*HealthcheckRequest_Body)(nil), // 42: tree.HealthcheckRequest.Body + (*Signature)(nil), // 43: tree.Signature + (*KeyValue)(nil), // 44: tree.KeyValue + (*LogMove)(nil), // 45: tree.LogMove } var file_pkg_services_tree_service_proto_depIdxs = []int32{ - 20, // 0: tree.AddRequest.body:type_name -> tree.AddRequest.Body - 41, // 1: tree.AddRequest.signature:type_name -> tree.Signature - 21, // 2: tree.AddResponse.body:type_name -> tree.AddResponse.Body - 41, // 3: tree.AddResponse.signature:type_name -> tree.Signature - 22, // 4: tree.AddByPathRequest.body:type_name -> tree.AddByPathRequest.Body - 41, // 5: tree.AddByPathRequest.signature:type_name -> tree.Signature - 23, // 6: tree.AddByPathResponse.body:type_name -> tree.AddByPathResponse.Body - 41, // 7: tree.AddByPathResponse.signature:type_name -> tree.Signature - 24, // 8: tree.RemoveRequest.body:type_name -> tree.RemoveRequest.Body - 41, // 9: tree.RemoveRequest.signature:type_name -> tree.Signature - 25, // 10: tree.RemoveResponse.body:type_name -> tree.RemoveResponse.Body - 41, // 11: tree.RemoveResponse.signature:type_name -> tree.Signature - 26, // 12: tree.MoveRequest.body:type_name -> tree.MoveRequest.Body - 41, // 13: tree.MoveRequest.signature:type_name -> tree.Signature - 27, // 14: tree.MoveResponse.body:type_name -> tree.MoveResponse.Body - 41, // 15: tree.MoveResponse.signature:type_name -> tree.Signature - 28, // 16: tree.GetNodeByPathRequest.body:type_name -> tree.GetNodeByPathRequest.Body - 41, // 17: tree.GetNodeByPathRequest.signature:type_name -> tree.Signature - 30, // 18: tree.GetNodeByPathResponse.body:type_name -> tree.GetNodeByPathResponse.Body - 41, // 19: tree.GetNodeByPathResponse.signature:type_name -> tree.Signature - 31, // 20: tree.GetSubTreeRequest.body:type_name -> tree.GetSubTreeRequest.Body - 41, // 21: tree.GetSubTreeRequest.signature:type_name -> tree.Signature - 32, // 22: tree.GetSubTreeResponse.body:type_name -> tree.GetSubTreeResponse.Body - 41, // 23: tree.GetSubTreeResponse.signature:type_name -> tree.Signature - 33, // 24: tree.TreeListRequest.body:type_name -> tree.TreeListRequest.Body - 41, // 25: tree.TreeListRequest.signature:type_name -> tree.Signature - 34, // 26: tree.TreeListResponse.body:type_name -> tree.TreeListResponse.Body - 41, // 27: tree.TreeListResponse.signature:type_name -> tree.Signature - 35, // 28: tree.ApplyRequest.body:type_name -> tree.ApplyRequest.Body - 41, // 29: tree.ApplyRequest.signature:type_name -> tree.Signature - 36, // 30: tree.ApplyResponse.body:type_name -> tree.ApplyResponse.Body - 41, // 31: tree.ApplyResponse.signature:type_name -> tree.Signature - 37, // 32: tree.GetOpLogRequest.body:type_name -> tree.GetOpLogRequest.Body - 41, // 33: tree.GetOpLogRequest.signature:type_name -> tree.Signature - 38, // 34: tree.GetOpLogResponse.body:type_name -> tree.GetOpLogResponse.Body - 41, // 35: tree.GetOpLogResponse.signature:type_name -> tree.Signature - 39, // 36: tree.HealthcheckResponse.body:type_name -> tree.HealthcheckResponse.Body - 41, // 37: tree.HealthcheckResponse.signature:type_name -> tree.Signature - 40, // 38: tree.HealthcheckRequest.body:type_name -> tree.HealthcheckRequest.Body - 41, // 39: tree.HealthcheckRequest.signature:type_name -> tree.Signature - 42, // 40: tree.AddRequest.Body.meta:type_name -> tree.KeyValue - 42, // 41: tree.AddByPathRequest.Body.meta:type_name -> tree.KeyValue - 42, // 42: tree.MoveRequest.Body.meta:type_name -> tree.KeyValue - 42, // 43: tree.GetNodeByPathResponse.Info.meta:type_name -> tree.KeyValue - 29, // 44: tree.GetNodeByPathResponse.Body.nodes:type_name -> tree.GetNodeByPathResponse.Info - 42, // 45: tree.GetSubTreeResponse.Body.meta:type_name -> tree.KeyValue - 43, // 46: tree.ApplyRequest.Body.operation:type_name -> tree.LogMove - 43, // 47: tree.GetOpLogResponse.Body.operation:type_name -> tree.LogMove - 0, // 48: tree.TreeService.Add:input_type -> tree.AddRequest - 2, // 49: tree.TreeService.AddByPath:input_type -> tree.AddByPathRequest - 4, // 50: tree.TreeService.Remove:input_type -> tree.RemoveRequest - 6, // 51: tree.TreeService.Move:input_type -> tree.MoveRequest - 8, // 52: tree.TreeService.GetNodeByPath:input_type -> tree.GetNodeByPathRequest - 10, // 53: tree.TreeService.GetSubTree:input_type -> tree.GetSubTreeRequest - 12, // 54: tree.TreeService.TreeList:input_type -> tree.TreeListRequest - 14, // 55: tree.TreeService.Apply:input_type -> tree.ApplyRequest - 16, // 56: tree.TreeService.GetOpLog:input_type -> tree.GetOpLogRequest - 19, // 57: tree.TreeService.Healthcheck:input_type -> tree.HealthcheckRequest - 1, // 58: tree.TreeService.Add:output_type -> tree.AddResponse - 3, // 59: tree.TreeService.AddByPath:output_type -> tree.AddByPathResponse - 5, // 60: tree.TreeService.Remove:output_type -> tree.RemoveResponse - 7, // 61: tree.TreeService.Move:output_type -> tree.MoveResponse - 9, // 62: tree.TreeService.GetNodeByPath:output_type -> tree.GetNodeByPathResponse - 11, // 63: tree.TreeService.GetSubTree:output_type -> tree.GetSubTreeResponse - 13, // 64: tree.TreeService.TreeList:output_type -> tree.TreeListResponse - 15, // 65: tree.TreeService.Apply:output_type -> tree.ApplyResponse - 17, // 66: tree.TreeService.GetOpLog:output_type -> tree.GetOpLogResponse - 18, // 67: tree.TreeService.Healthcheck:output_type -> tree.HealthcheckResponse - 58, // [58:68] is the sub-list for method output_type - 48, // [48:58] is the sub-list for method input_type - 48, // [48:48] is the sub-list for extension type_name - 48, // [48:48] is the sub-list for extension extendee - 0, // [0:48] is the sub-list for field type_name + 21, // 0: tree.AddRequest.body:type_name -> tree.AddRequest.Body + 43, // 1: tree.AddRequest.signature:type_name -> tree.Signature + 22, // 2: tree.AddResponse.body:type_name -> tree.AddResponse.Body + 43, // 3: tree.AddResponse.signature:type_name -> tree.Signature + 23, // 4: tree.AddByPathRequest.body:type_name -> tree.AddByPathRequest.Body + 43, // 5: tree.AddByPathRequest.signature:type_name -> tree.Signature + 24, // 6: tree.AddByPathResponse.body:type_name -> tree.AddByPathResponse.Body + 43, // 7: tree.AddByPathResponse.signature:type_name -> tree.Signature + 25, // 8: tree.RemoveRequest.body:type_name -> tree.RemoveRequest.Body + 43, // 9: tree.RemoveRequest.signature:type_name -> tree.Signature + 26, // 10: tree.RemoveResponse.body:type_name -> tree.RemoveResponse.Body + 43, // 11: tree.RemoveResponse.signature:type_name -> tree.Signature + 27, // 12: tree.MoveRequest.body:type_name -> tree.MoveRequest.Body + 43, // 13: tree.MoveRequest.signature:type_name -> tree.Signature + 28, // 14: tree.MoveResponse.body:type_name -> tree.MoveResponse.Body + 43, // 15: tree.MoveResponse.signature:type_name -> tree.Signature + 29, // 16: tree.GetNodeByPathRequest.body:type_name -> tree.GetNodeByPathRequest.Body + 43, // 17: tree.GetNodeByPathRequest.signature:type_name -> tree.Signature + 31, // 18: tree.GetNodeByPathResponse.body:type_name -> tree.GetNodeByPathResponse.Body + 43, // 19: tree.GetNodeByPathResponse.signature:type_name -> tree.Signature + 32, // 20: tree.GetSubTreeRequest.body:type_name -> tree.GetSubTreeRequest.Body + 43, // 21: tree.GetSubTreeRequest.signature:type_name -> tree.Signature + 34, // 22: tree.GetSubTreeResponse.body:type_name -> tree.GetSubTreeResponse.Body + 43, // 23: tree.GetSubTreeResponse.signature:type_name -> tree.Signature + 35, // 24: tree.TreeListRequest.body:type_name -> tree.TreeListRequest.Body + 43, // 25: tree.TreeListRequest.signature:type_name -> tree.Signature + 36, // 26: tree.TreeListResponse.body:type_name -> tree.TreeListResponse.Body + 43, // 27: tree.TreeListResponse.signature:type_name -> tree.Signature + 37, // 28: tree.ApplyRequest.body:type_name -> tree.ApplyRequest.Body + 43, // 29: tree.ApplyRequest.signature:type_name -> tree.Signature + 38, // 30: tree.ApplyResponse.body:type_name -> tree.ApplyResponse.Body + 43, // 31: tree.ApplyResponse.signature:type_name -> tree.Signature + 39, // 32: tree.GetOpLogRequest.body:type_name -> tree.GetOpLogRequest.Body + 43, // 33: tree.GetOpLogRequest.signature:type_name -> tree.Signature + 40, // 34: tree.GetOpLogResponse.body:type_name -> tree.GetOpLogResponse.Body + 43, // 35: tree.GetOpLogResponse.signature:type_name -> tree.Signature + 41, // 36: tree.HealthcheckResponse.body:type_name -> tree.HealthcheckResponse.Body + 43, // 37: tree.HealthcheckResponse.signature:type_name -> tree.Signature + 42, // 38: tree.HealthcheckRequest.body:type_name -> tree.HealthcheckRequest.Body + 43, // 39: tree.HealthcheckRequest.signature:type_name -> tree.Signature + 44, // 40: tree.AddRequest.Body.meta:type_name -> tree.KeyValue + 44, // 41: tree.AddByPathRequest.Body.meta:type_name -> tree.KeyValue + 44, // 42: tree.MoveRequest.Body.meta:type_name -> tree.KeyValue + 44, // 43: tree.GetNodeByPathResponse.Info.meta:type_name -> tree.KeyValue + 30, // 44: tree.GetNodeByPathResponse.Body.nodes:type_name -> tree.GetNodeByPathResponse.Info + 33, // 45: tree.GetSubTreeRequest.Body.order_by:type_name -> tree.GetSubTreeRequest.Body.Order + 0, // 46: tree.GetSubTreeRequest.Body.Order.direction:type_name -> tree.GetSubTreeRequest.Body.Order.Direction + 44, // 47: tree.GetSubTreeResponse.Body.meta:type_name -> tree.KeyValue + 45, // 48: tree.ApplyRequest.Body.operation:type_name -> tree.LogMove + 45, // 49: tree.GetOpLogResponse.Body.operation:type_name -> tree.LogMove + 1, // 50: tree.TreeService.Add:input_type -> tree.AddRequest + 3, // 51: tree.TreeService.AddByPath:input_type -> tree.AddByPathRequest + 5, // 52: tree.TreeService.Remove:input_type -> tree.RemoveRequest + 7, // 53: tree.TreeService.Move:input_type -> tree.MoveRequest + 9, // 54: tree.TreeService.GetNodeByPath:input_type -> tree.GetNodeByPathRequest + 11, // 55: tree.TreeService.GetSubTree:input_type -> tree.GetSubTreeRequest + 13, // 56: tree.TreeService.TreeList:input_type -> tree.TreeListRequest + 15, // 57: tree.TreeService.Apply:input_type -> tree.ApplyRequest + 17, // 58: tree.TreeService.GetOpLog:input_type -> tree.GetOpLogRequest + 20, // 59: tree.TreeService.Healthcheck:input_type -> tree.HealthcheckRequest + 2, // 60: tree.TreeService.Add:output_type -> tree.AddResponse + 4, // 61: tree.TreeService.AddByPath:output_type -> tree.AddByPathResponse + 6, // 62: tree.TreeService.Remove:output_type -> tree.RemoveResponse + 8, // 63: tree.TreeService.Move:output_type -> tree.MoveResponse + 10, // 64: tree.TreeService.GetNodeByPath:output_type -> tree.GetNodeByPathResponse + 12, // 65: tree.TreeService.GetSubTree:output_type -> tree.GetSubTreeResponse + 14, // 66: tree.TreeService.TreeList:output_type -> tree.TreeListResponse + 16, // 67: tree.TreeService.Apply:output_type -> tree.ApplyResponse + 18, // 68: tree.TreeService.GetOpLog:output_type -> tree.GetOpLogResponse + 19, // 69: tree.TreeService.Healthcheck:output_type -> tree.HealthcheckResponse + 60, // [60:70] is the sub-list for method output_type + 50, // [50:60] is the sub-list for method input_type + 50, // [50:50] is the sub-list for extension type_name + 50, // [50:50] is the sub-list for extension extendee + 0, // [0:50] is the sub-list for field type_name } func init() { file_pkg_services_tree_service_proto_init() } @@ -3325,7 +3443,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSubTreeResponse_Body); i { + switch v := v.(*GetSubTreeRequest_Body_Order); i { case 0: return &v.state case 1: @@ -3337,7 +3455,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TreeListRequest_Body); i { + switch v := v.(*GetSubTreeResponse_Body); i { case 0: return &v.state case 1: @@ -3349,7 +3467,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TreeListResponse_Body); i { + switch v := v.(*TreeListRequest_Body); i { case 0: return &v.state case 1: @@ -3361,7 +3479,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplyRequest_Body); i { + switch v := v.(*TreeListResponse_Body); i { case 0: return &v.state case 1: @@ -3373,7 +3491,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplyResponse_Body); i { + switch v := v.(*ApplyRequest_Body); i { case 0: return &v.state case 1: @@ -3385,7 +3503,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetOpLogRequest_Body); i { + switch v := v.(*ApplyResponse_Body); i { case 0: return &v.state case 1: @@ -3397,7 +3515,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetOpLogResponse_Body); i { + switch v := v.(*GetOpLogRequest_Body); i { case 0: return &v.state case 1: @@ -3409,7 +3527,7 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthcheckResponse_Body); i { + switch v := v.(*GetOpLogResponse_Body); i { case 0: return &v.state case 1: @@ -3421,6 +3539,18 @@ func file_pkg_services_tree_service_proto_init() { } } file_pkg_services_tree_service_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthcheckResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_tree_service_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HealthcheckRequest_Body); i { case 0: return &v.state @@ -3438,13 +3568,14 @@ func file_pkg_services_tree_service_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_services_tree_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 41, + NumEnums: 1, + NumMessages: 42, NumExtensions: 0, NumServices: 1, }, GoTypes: file_pkg_services_tree_service_proto_goTypes, DependencyIndexes: file_pkg_services_tree_service_proto_depIdxs, + EnumInfos: file_pkg_services_tree_service_proto_enumTypes, MessageInfos: file_pkg_services_tree_service_proto_msgTypes, }.Build() File_pkg_services_tree_service_proto = out.File diff --git a/pool/tree/service/service_grpc.pb.go b/pool/tree/service/service_grpc.pb.go index f981746..2c08289 100644 --- a/pool/tree/service/service_grpc.pb.go +++ b/pool/tree/service/service_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.12.4 +// - protoc v3.21.9 // source: pkg/services/tree/service.proto package tree diff --git a/pool/tree/service/types.pb.go b/pool/tree/service/types.pb.go index 45d8891..b4d6981 100644 --- a/pool/tree/service/types.pb.go +++ b/pool/tree/service/types.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.12.4 +// protoc v3.21.9 // source: pkg/services/tree/types.proto package tree diff --git a/syncTree.sh b/syncTree.sh index 9bb758b..90eeba7 100755 --- a/syncTree.sh +++ b/syncTree.sh @@ -1,6 +1,6 @@ #!/bin/bash -REVISION="f07d4158f50ed5c7f44cc0bc224c3d03edf27f3b" +REVISION="b3695411d907c3c65485bab04f9ff8479a72906b" echo "tree service revision ${REVISION}" From d376302a3bb4a6875b53879ac033e899d76924c8 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 2 Aug 2023 18:23:32 +0300 Subject: [PATCH 061/323] [#121] client: Make PrmContainerGet fields public Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_get.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/client/container_get.go b/client/container_get.go index 9e98523..0e2d028 100644 --- a/client/container_get.go +++ b/client/container_get.go @@ -18,26 +18,31 @@ import ( // PrmContainerGet groups parameters of ContainerGet operation. type PrmContainerGet struct { - prmCommonMeta + // FrostFS request X-Headers + XHeaders []string - idSet bool - id cid.ID + CID *cid.ID } // SetContainer sets identifier of the container to be read. // Required parameter. -func (x *PrmContainerGet) SetContainer(id cid.ID) { - x.id = id - x.idSet = true +// +// Deprecated: Use PrmContainerGet.CID instead. +func (prm *PrmContainerGet) SetContainer(cid cid.ID) { + prm.CID = &cid } -func (x *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { - if !x.idSet { +func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { + if prm.CID == nil { return nil, errorMissingContainer } + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + var cidV2 refs.ContainerID - x.id.WriteToV2(&cidV2) + prm.CID.WriteToV2(&cidV2) reqBody := new(v2container.GetRequestBody) reqBody.SetContainerID(&cidV2) From 55c52c8d5d6bf0d5dab97f14649e8709d4ba290a Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 2 Aug 2023 18:56:41 +0300 Subject: [PATCH 062/323] [#121] pool: Make PrmContainerGet fields public * Also refactor client PrmContainerGet usage Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_get.go | 12 ++++++------ pool/pool.go | 13 ++++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/container_get.go b/client/container_get.go index 0e2d028..d2ef0fe 100644 --- a/client/container_get.go +++ b/client/container_get.go @@ -18,22 +18,22 @@ import ( // PrmContainerGet groups parameters of ContainerGet operation. type PrmContainerGet struct { - // FrostFS request X-Headers + // FrostFS request X-Headers. XHeaders []string - CID *cid.ID + ContainerID *cid.ID } // SetContainer sets identifier of the container to be read. // Required parameter. // -// Deprecated: Use PrmContainerGet.CID instead. +// Deprecated: Use PrmContainerGet.ContainerID instead. func (prm *PrmContainerGet) SetContainer(cid cid.ID) { - prm.CID = &cid + prm.ContainerID = &cid } func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, error) { - if prm.CID == nil { + if prm.ContainerID == nil { return nil, errorMissingContainer } @@ -42,7 +42,7 @@ func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, er } var cidV2 refs.ContainerID - prm.CID.WriteToV2(&cidV2) + prm.ContainerID.WriteToV2(&cidV2) reqBody := new(v2container.GetRequestBody) reqBody.SetContainerID(&cidV2) diff --git a/pool/pool.go b/pool/pool.go index 04b84aa..833b57e 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -438,8 +438,9 @@ func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) ( return container.Container{}, err } - var cliPrm sdkClient.PrmContainerGet - cliPrm.SetContainer(prm.cnrID) + cliPrm := sdkClient.PrmContainerGet{ + ContainerID: &prm.ContainerID, + } start := time.Now() res, err := cl.ContainerGet(ctx, cliPrm) @@ -1444,12 +1445,14 @@ func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams) { // PrmContainerGet groups parameters of GetContainer operation. type PrmContainerGet struct { - cnrID cid.ID + ContainerID cid.ID } // SetContainerID specifies identifier of the container to be read. -func (x *PrmContainerGet) SetContainerID(cnrID cid.ID) { - x.cnrID = cnrID +// +// Deprecated: Use PrmContainerGet.ContainerID instead. +func (prm *PrmContainerGet) SetContainerID(cnrID cid.ID) { + prm.ContainerID = cnrID } // PrmContainerList groups parameters of ListContainers operation. From 3dc8129ed79406b7f0e523be471f30e3014b9107 Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Wed, 2 Aug 2023 10:01:03 +0300 Subject: [PATCH 063/323] [#135] Make all error status receivers pointers Signed-off-by: Alejandro Lopez --- client/errors.go | 24 +++++------------- client/errors_test.go | 47 +++++++++++------------------------ client/status/common.go | 8 +++--- client/status/container.go | 4 +-- client/status/object.go | 12 ++++----- client/status/session.go | 4 +-- client/status/unrecognized.go | 2 +- pool/pool.go | 8 +++--- pool/pool_test.go | 20 +++++++-------- 9 files changed, 49 insertions(+), 80 deletions(-) diff --git a/client/errors.go b/client/errors.go index bf2b1ea..769b442 100644 --- a/client/errors.go +++ b/client/errors.go @@ -22,9 +22,7 @@ func IsErrContainerNotFound(err error) bool { switch unwrapErr(err).(type) { default: return false - case - apistatus.ContainerNotFound, - *apistatus.ContainerNotFound: + case *apistatus.ContainerNotFound: return true } } @@ -35,9 +33,7 @@ func IsErrEACLNotFound(err error) bool { switch unwrapErr(err).(type) { default: return false - case - apistatus.EACLNotFound, - *apistatus.EACLNotFound: + case *apistatus.EACLNotFound: return true } } @@ -48,9 +44,7 @@ func IsErrObjectNotFound(err error) bool { switch unwrapErr(err).(type) { default: return false - case - apistatus.ObjectNotFound, - *apistatus.ObjectNotFound: + case *apistatus.ObjectNotFound: return true } } @@ -61,9 +55,7 @@ func IsErrObjectAlreadyRemoved(err error) bool { switch unwrapErr(err).(type) { default: return false - case - apistatus.ObjectAlreadyRemoved, - *apistatus.ObjectAlreadyRemoved: + case *apistatus.ObjectAlreadyRemoved: return true } } @@ -74,9 +66,7 @@ func IsErrSessionExpired(err error) bool { switch unwrapErr(err).(type) { default: return false - case - apistatus.SessionTokenExpired, - *apistatus.SessionTokenExpired: + case *apistatus.SessionTokenExpired: return true } } @@ -87,9 +77,7 @@ func IsErrSessionNotFound(err error) bool { switch unwrapErr(err).(type) { default: return false - case - apistatus.SessionTokenNotFound, - *apistatus.SessionTokenNotFound: + case *apistatus.SessionTokenNotFound: return true } } diff --git a/client/errors_test.go b/client/errors_test.go index 657d0fe..90114d7 100644 --- a/client/errors_test.go +++ b/client/errors_test.go @@ -10,59 +10,40 @@ import ( ) func TestErrors(t *testing.T) { - for _, tc := range []struct { + errs := []struct { check func(error) bool - errs []error + err error }{ { check: client.IsErrContainerNotFound, - errs: []error{ - apistatus.ContainerNotFound{}, - new(apistatus.ContainerNotFound), - }, + err: new(apistatus.ContainerNotFound), }, { check: client.IsErrEACLNotFound, - errs: []error{ - apistatus.EACLNotFound{}, - new(apistatus.EACLNotFound), - }, + err: new(apistatus.EACLNotFound), }, { check: client.IsErrObjectNotFound, - errs: []error{ - apistatus.ObjectNotFound{}, - new(apistatus.ObjectNotFound), - }, + err: new(apistatus.ObjectNotFound), }, { check: client.IsErrObjectAlreadyRemoved, - errs: []error{ - apistatus.ObjectAlreadyRemoved{}, - new(apistatus.ObjectAlreadyRemoved), - }, + err: new(apistatus.ObjectAlreadyRemoved), }, { check: client.IsErrSessionExpired, - errs: []error{ - apistatus.SessionTokenExpired{}, - new(apistatus.SessionTokenExpired), - }, + err: new(apistatus.SessionTokenExpired), }, { check: client.IsErrSessionNotFound, - errs: []error{ - apistatus.SessionTokenNotFound{}, - new(apistatus.SessionTokenNotFound), - }, + err: new(apistatus.SessionTokenNotFound), }, - } { - require.NotEmpty(t, tc.errs) + } - for i := range tc.errs { - require.True(t, tc.check(tc.errs[i]), tc.errs[i]) - require.True(t, tc.check(fmt.Errorf("top-level context: :%w", - fmt.Errorf("inner context: %w", tc.errs[i])), - ), tc.errs[i]) + for i := range errs { + for j := range errs { + nestedErr := fmt.Errorf("top-level context: :%w", fmt.Errorf("inner context: %w", errs[j].err)) + require.Equal(t, i == j, errs[i].check(errs[j].err)) + require.Equal(t, i == j, errs[i].check(nestedErr)) } } } diff --git a/client/status/common.go b/client/status/common.go index 421d532..af0dc8e 100644 --- a/client/status/common.go +++ b/client/status/common.go @@ -14,7 +14,7 @@ type ServerInternal struct { v2 status.Status } -func (x ServerInternal) Error() string { +func (x *ServerInternal) Error() string { return errMessageStatusV2( globalizeCodeV2(status.Internal, status.GlobalizeCommonFail), x.v2.Message(), @@ -62,7 +62,7 @@ type WrongMagicNumber struct { v2 status.Status } -func (x WrongMagicNumber) Error() string { +func (x *WrongMagicNumber) Error() string { return errMessageStatusV2( globalizeCodeV2(status.WrongMagicNumber, status.GlobalizeCommonFail), x.v2.Message(), @@ -132,7 +132,7 @@ type SignatureVerification struct { const defaultSignatureVerificationMsg = "signature verification failed" -func (x SignatureVerification) Error() string { +func (x *SignatureVerification) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultSignatureVerificationMsg @@ -191,7 +191,7 @@ type NodeUnderMaintenance struct { const defaultNodeUnderMaintenanceMsg = "node is under maintenance" // Error implements the error interface. -func (x NodeUnderMaintenance) Error() string { +func (x *NodeUnderMaintenance) Error() string { msg := x.Message() if msg == "" { msg = defaultNodeUnderMaintenanceMsg diff --git a/client/status/container.go b/client/status/container.go index c62aaac..9f06b27 100644 --- a/client/status/container.go +++ b/client/status/container.go @@ -13,7 +13,7 @@ type ContainerNotFound struct { const defaultContainerNotFoundMsg = "container not found" -func (x ContainerNotFound) Error() string { +func (x *ContainerNotFound) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultContainerNotFoundMsg @@ -51,7 +51,7 @@ type EACLNotFound struct { const defaultEACLNotFoundMsg = "eACL not found" -func (x EACLNotFound) Error() string { +func (x *EACLNotFound) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultEACLNotFoundMsg diff --git a/client/status/object.go b/client/status/object.go index 579cb93..27ea86c 100644 --- a/client/status/object.go +++ b/client/status/object.go @@ -13,7 +13,7 @@ type ObjectLocked struct { const defaultObjectLockedMsg = "object is locked" -func (x ObjectLocked) Error() string { +func (x *ObjectLocked) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultObjectLockedMsg @@ -50,7 +50,7 @@ type LockNonRegularObject struct { const defaultLockNonRegularObjectMsg = "locking non-regular object is forbidden" -func (x LockNonRegularObject) Error() string { +func (x *LockNonRegularObject) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultLockNonRegularObjectMsg @@ -87,7 +87,7 @@ type ObjectAccessDenied struct { const defaultObjectAccessDeniedMsg = "access to object operation denied" -func (x ObjectAccessDenied) Error() string { +func (x *ObjectAccessDenied) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultObjectAccessDeniedMsg @@ -135,7 +135,7 @@ type ObjectNotFound struct { const defaultObjectNotFoundMsg = "object not found" -func (x ObjectNotFound) Error() string { +func (x *ObjectNotFound) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultObjectNotFoundMsg @@ -172,7 +172,7 @@ type ObjectAlreadyRemoved struct { const defaultObjectAlreadyRemovedMsg = "object already removed" -func (x ObjectAlreadyRemoved) Error() string { +func (x *ObjectAlreadyRemoved) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultObjectAlreadyRemovedMsg @@ -210,7 +210,7 @@ type ObjectOutOfRange struct { const defaultObjectOutOfRangeMsg = "out of range" -func (x ObjectOutOfRange) Error() string { +func (x *ObjectOutOfRange) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultObjectOutOfRangeMsg diff --git a/client/status/session.go b/client/status/session.go index 6c54965..6f60758 100644 --- a/client/status/session.go +++ b/client/status/session.go @@ -13,7 +13,7 @@ type SessionTokenNotFound struct { const defaultSessionTokenNotFoundMsg = "session token not found" -func (x SessionTokenNotFound) Error() string { +func (x *SessionTokenNotFound) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultSessionTokenNotFoundMsg @@ -50,7 +50,7 @@ type SessionTokenExpired struct { const defaultSessionTokenExpiredMsg = "expired session token" -func (x SessionTokenExpired) Error() string { +func (x *SessionTokenExpired) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultSessionTokenExpiredMsg diff --git a/client/status/unrecognized.go b/client/status/unrecognized.go index b9a8cdb..19e481e 100644 --- a/client/status/unrecognized.go +++ b/client/status/unrecognized.go @@ -8,7 +8,7 @@ type unrecognizedStatusV2 struct { v2 status.Status } -func (x unrecognizedStatusV2) Error() string { +func (x *unrecognizedStatusV2) Error() string { return errMessageStatusV2("unrecognized", x.v2.Message()) } diff --git a/pool/pool.go b/pool/pool.go index 833b57e..3fb4e9e 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -1015,10 +1015,10 @@ func (c *clientStatusMonitor) handleError(ctx context.Context, st apistatus.Stat err = apistatus.ErrFromStatus(st) switch err.(type) { - case apistatus.ServerInternal, *apistatus.ServerInternal, - apistatus.WrongMagicNumber, *apistatus.WrongMagicNumber, - apistatus.SignatureVerification, *apistatus.SignatureVerification, - apistatus.NodeUnderMaintenance, *apistatus.NodeUnderMaintenance: + case *apistatus.ServerInternal, + *apistatus.WrongMagicNumber, + *apistatus.SignatureVerification, + *apistatus.NodeUnderMaintenance: c.incErrorRate() } diff --git a/pool/pool_test.go b/pool/pool_test.go index bc0407e..623d429 100644 --- a/pool/pool_test.go +++ b/pool/pool_test.go @@ -271,7 +271,7 @@ func TestSessionCache(t *testing.T) { mockClientBuilder := func(addr string) client { mockCli := newMockClient(addr, *key) - mockCli.statusOnGetObject(apistatus.SessionTokenNotFound{}) + mockCli.statusOnGetObject(new(apistatus.SessionTokenNotFound)) return mockCli } @@ -548,14 +548,14 @@ func TestHandleError(t *testing.T) { }, { ctx: ctx, - status: apistatus.SuccessDefaultV2{}, + status: new(apistatus.SuccessDefaultV2), err: nil, expectedError: false, countError: false, }, { ctx: ctx, - status: apistatus.SuccessDefaultV2{}, + status: new(apistatus.SuccessDefaultV2), err: errors.New("error"), expectedError: true, countError: true, @@ -569,42 +569,42 @@ func TestHandleError(t *testing.T) { }, { ctx: ctx, - status: apistatus.ObjectNotFound{}, + status: new(apistatus.ObjectNotFound), err: nil, expectedError: true, countError: false, }, { ctx: ctx, - status: apistatus.ServerInternal{}, + status: new(apistatus.ServerInternal), err: nil, expectedError: true, countError: true, }, { ctx: ctx, - status: apistatus.WrongMagicNumber{}, + status: new(apistatus.WrongMagicNumber), err: nil, expectedError: true, countError: true, }, { ctx: ctx, - status: apistatus.SignatureVerification{}, + status: new(apistatus.SignatureVerification), err: nil, expectedError: true, countError: true, }, { ctx: ctx, - status: &apistatus.SignatureVerification{}, + status: new(apistatus.SignatureVerification), err: nil, expectedError: true, countError: true, }, { ctx: ctx, - status: apistatus.NodeUnderMaintenance{}, + status: new(apistatus.NodeUnderMaintenance), err: nil, expectedError: true, countError: true, @@ -649,7 +649,7 @@ func TestSwitchAfterErrorThreshold(t *testing.T) { if addr == nodes[0].address { mockCli := newMockClient(addr, *key) mockCli.setThreshold(uint32(errorThreshold)) - mockCli.statusOnGetObject(apistatus.ServerInternal{}) + mockCli.statusOnGetObject(new(apistatus.ServerInternal)) return mockCli } From 9e5faaf8299339198ca4e3ec830f2962617613fa Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Thu, 3 Aug 2023 11:42:54 +0300 Subject: [PATCH 064/323] [#121] client: Make PrmContainerDelete fields public Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_delete.go | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/client/container_delete.go b/client/container_delete.go index 0059988..70d5f40 100644 --- a/client/container_delete.go +++ b/client/container_delete.go @@ -18,29 +18,33 @@ import ( // PrmContainerDelete groups parameters of ContainerDelete operation. type PrmContainerDelete struct { - prmCommonMeta + // FrostFS request X-Headers + XHeaders []string - idSet bool - id cid.ID + ContainerID *cid.ID - tokSet bool - tok session.Container + Session *session.Container } // SetContainer sets identifier of the FrostFS container to be removed. // Required parameter. +// +// Deprecated: Use PrmContainerDelete.Container instead. func (x *PrmContainerDelete) SetContainer(id cid.ID) { - x.id = id - x.idSet = true + x.ContainerID = &id } -func (x *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest, error) { - if !x.idSet { +func (prm *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest, error) { + if prm.ContainerID == nil { return nil, errorMissingContainer } + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + var cidV2 refs.ContainerID - x.id.WriteToV2(&cidV2) + prm.ContainerID.WriteToV2(&cidV2) // Container contract expects signature of container ID value, // don't get confused with stable marshaled protobuf container.ID structure. @@ -61,11 +65,11 @@ func (x *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest reqBody.SetSignature(&sigv2) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.prmCommonMeta.xHeaders, &meta) + writeXHeadersToMeta(prm.XHeaders, &meta) - if x.tokSet { + if prm.Session != nil { var tokv2 v2session.Token - x.tok.WriteToV2(&tokv2) + prm.Session.WriteToV2(&tokv2) meta.SetSessionToken(&tokv2) } @@ -82,9 +86,10 @@ func (x *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest // This may affect the execution of an operation (e.g. access control). // // Must be signed. +// +// Deprecated: Use PrmContainerDelete.Session instead. func (x *PrmContainerDelete) WithinSession(tok session.Container) { - x.tok = tok - x.tokSet = true + x.Session = &tok } // ResContainerDelete groups resulting values of ContainerDelete operation. From be28b89312fe7972655e746eef813ce4f20dd797 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Thu, 3 Aug 2023 12:11:14 +0300 Subject: [PATCH 065/323] [#121] pool: Make PrmContainerDelete fields public * Refactor client PrmContainerDelete usage * Introduce WaitParams CheckValidity method Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- pool/pool.go | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 3fb4e9e..31bf84f 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -487,10 +487,9 @@ func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDel return err } - var cliPrm sdkClient.PrmContainerDelete - cliPrm.SetContainer(prm.cnrID) - if prm.stokenSet { - cliPrm.WithinSession(prm.stoken) + cliPrm := sdkClient.PrmContainerDelete{ + ContainerID: &prm.ContainerID, + Session: prm.Session, } start := time.Now() @@ -504,11 +503,14 @@ func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDel return fmt.Errorf("container delete on client: %w", err) } - if !prm.waitParamsSet { - prm.waitParams.setDefaults() + if prm.WaitParams == nil { + prm.WaitParams = defaultWaitParams() + } + if err := prm.WaitParams.CheckValidity(); err != nil { + return fmt.Errorf("invalid wait parameters: %w", err) } - return waitForContainerRemoved(ctx, c, &prm.cnrID, &prm.waitParams) + return waitForContainerRemoved(ctx, c, &prm.ContainerID, prm.WaitParams) } // containerEACL invokes sdkClient.ContainerEACL parse response status to error and return result as is. @@ -1236,6 +1238,17 @@ func (x *WaitParams) checkForPositive() { } } +// CheckForValid checks if all wait params are non-negative. +func (waitPrm *WaitParams) CheckValidity() error { + if waitPrm.timeout <= 0 { + return errors.New("timeout cannot be negative") + } + if waitPrm.pollInterval <= 0 { + return errors.New("poll interval cannot be negative") + } + return nil +} + type prmContext struct { defaultSession bool verb session.ObjectVerb @@ -1467,33 +1480,35 @@ func (x *PrmContainerList) SetOwnerID(ownerID user.ID) { // PrmContainerDelete groups parameters of DeleteContainer operation. type PrmContainerDelete struct { - cnrID cid.ID + ContainerID cid.ID - stoken session.Container - stokenSet bool + Session *session.Container - waitParams WaitParams - waitParamsSet bool + WaitParams *WaitParams } // SetContainerID specifies identifier of the FrostFS container to be removed. +// +// Deprecated: Use PrmContainerDelete.ContainerID instead. func (x *PrmContainerDelete) SetContainerID(cnrID cid.ID) { - x.cnrID = cnrID + x.ContainerID = cnrID } // SetSessionToken specifies session within which operation should be performed. +// +// Deprecated: Use PrmContainerDelete.Session instead. func (x *PrmContainerDelete) SetSessionToken(token session.Container) { - x.stoken = token - x.stokenSet = true + x.Session = &token } // SetWaitParams specifies timeout params to complete operation. // If not provided the default one will be used. // Panics if any of the wait params isn't positive. +// +// Deprecated: Use PrmContainerDelete.WaitParams instead. func (x *PrmContainerDelete) SetWaitParams(waitParams WaitParams) { waitParams.checkForPositive() - x.waitParams = waitParams - x.waitParamsSet = true + x.WaitParams = &waitParams } // PrmContainerEACL groups parameters of GetEACL operation. From 936e6d230b74a22a060ea89f3810ff7e01320a15 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Thu, 3 Aug 2023 12:14:00 +0300 Subject: [PATCH 066/323] [#121] pool: Add wait params validation for containerPut method * Add WaitParams.CheckValidity() check because SetWaitParams is deprecated, but parameters were checked within this setter with checkForPositive() Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- client/container_delete.go | 8 ++++---- pool/pool.go | 38 +++++++++++++++++++++++--------------- pool/pool_test.go | 12 ++++++------ 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/client/container_delete.go b/client/container_delete.go index 70d5f40..181c15b 100644 --- a/client/container_delete.go +++ b/client/container_delete.go @@ -30,8 +30,8 @@ type PrmContainerDelete struct { // Required parameter. // // Deprecated: Use PrmContainerDelete.Container instead. -func (x *PrmContainerDelete) SetContainer(id cid.ID) { - x.ContainerID = &id +func (prm *PrmContainerDelete) SetContainer(id cid.ID) { + prm.ContainerID = &id } func (prm *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteRequest, error) { @@ -88,8 +88,8 @@ func (prm *PrmContainerDelete) buildRequest(c *Client) (*v2container.DeleteReque // Must be signed. // // Deprecated: Use PrmContainerDelete.Session instead. -func (x *PrmContainerDelete) WithinSession(tok session.Container) { - x.Session = &tok +func (prm *PrmContainerDelete) WithinSession(tok session.Container) { + prm.Session = &tok } // ResContainerDelete groups resulting values of ContainerDelete operation. diff --git a/pool/pool.go b/pool/pool.go index 31bf84f..075ba7f 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -420,6 +420,9 @@ func (c *clientWrapper) containerPut(ctx context.Context, prm PrmContainerPut) ( if prm.WaitParams == nil { prm.WaitParams = defaultWaitParams() } + if err = prm.WaitParams.CheckValidity(); err != nil { + return cid.ID{}, fmt.Errorf("invalid wait parameters: %w", err) + } idCnr := res.ID() @@ -1205,45 +1208,50 @@ func (x *NodeParam) Weight() float64 { // WaitParams contains parameters used in polling is a something applied on FrostFS network. type WaitParams struct { - timeout time.Duration - pollInterval time.Duration + Timeout time.Duration + PollInterval time.Duration } // SetTimeout specifies the time to wait for the operation to complete. +// +// Deprecated: Use WaitParams.Timeout instead. func (x *WaitParams) SetTimeout(timeout time.Duration) { - x.timeout = timeout + x.Timeout = timeout } // SetPollInterval specifies the interval, once it will check the completion of the operation. +// +// Deprecated: Use WaitParams.PollInterval instead. func (x *WaitParams) SetPollInterval(tick time.Duration) { - x.pollInterval = tick + x.PollInterval = tick } +// Deprecated: Use defaultWaitParams() instead. func (x *WaitParams) setDefaults() { - x.timeout = 120 * time.Second - x.pollInterval = 5 * time.Second + x.Timeout = 120 * time.Second + x.PollInterval = 5 * time.Second } func defaultWaitParams() *WaitParams { return &WaitParams{ - timeout: 120 * time.Second, - pollInterval: 5 * time.Second, + Timeout: 120 * time.Second, + PollInterval: 5 * time.Second, } } // checkForPositive panics if any of the wait params isn't positive. func (x *WaitParams) checkForPositive() { - if x.timeout <= 0 || x.pollInterval <= 0 { + if x.Timeout <= 0 || x.PollInterval <= 0 { panic("all wait params must be positive") } } // CheckForValid checks if all wait params are non-negative. -func (waitPrm *WaitParams) CheckValidity() error { - if waitPrm.timeout <= 0 { +func (x *WaitParams) CheckValidity() error { + if x.Timeout <= 0 { return errors.New("timeout cannot be negative") } - if waitPrm.pollInterval <= 0 { + if x.PollInterval <= 0 { return errors.New("poll interval cannot be negative") } return nil @@ -2533,9 +2541,9 @@ func waitForContainerRemoved(ctx context.Context, cli client, cnrID *cid.ID, wai // waitFor await that given condition will be met in waitParams time. func waitFor(ctx context.Context, params *WaitParams, condition func(context.Context) bool) error { - wctx, cancel := context.WithTimeout(ctx, params.timeout) + wctx, cancel := context.WithTimeout(ctx, params.Timeout) defer cancel() - ticker := time.NewTimer(params.pollInterval) + ticker := time.NewTimer(params.PollInterval) defer ticker.Stop() wdone := wctx.Done() done := ctx.Done() @@ -2549,7 +2557,7 @@ func waitFor(ctx context.Context, params *WaitParams, condition func(context.Con if condition(ctx) { return nil } - ticker.Reset(params.pollInterval) + ticker.Reset(params.PollInterval) } } } diff --git a/pool/pool_test.go b/pool/pool_test.go index 623d429..08de667 100644 --- a/pool/pool_test.go +++ b/pool/pool_test.go @@ -483,8 +483,8 @@ func TestWaitPresence(t *testing.T) { var idCnr cid.ID err := waitForContainerPresence(ctx, mockCli, idCnr, &WaitParams{ - timeout: 120 * time.Second, - pollInterval: 5 * time.Second, + Timeout: 120 * time.Second, + PollInterval: 5 * time.Second, }) require.Error(t, err) require.Contains(t, err.Error(), "context canceled") @@ -494,8 +494,8 @@ func TestWaitPresence(t *testing.T) { ctx := context.Background() var idCnr cid.ID err := waitForContainerPresence(ctx, mockCli, idCnr, &WaitParams{ - timeout: 500 * time.Millisecond, - pollInterval: 5 * time.Second, + Timeout: 500 * time.Millisecond, + PollInterval: 5 * time.Second, }) require.Error(t, err) require.Contains(t, err.Error(), "context deadline exceeded") @@ -505,8 +505,8 @@ func TestWaitPresence(t *testing.T) { ctx := context.Background() var idCnr cid.ID err := waitForContainerPresence(ctx, mockCli, idCnr, &WaitParams{ - timeout: 10 * time.Second, - pollInterval: 500 * time.Millisecond, + Timeout: 10 * time.Second, + PollInterval: 500 * time.Millisecond, }) require.NoError(t, err) }) From 6353df8bca63075a24ee736ba36055f4e87e334a Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Fri, 4 Aug 2023 11:43:36 +0300 Subject: [PATCH 067/323] [#142] Fix unwrapErr for go 1.20 Signed-off-by: Alejandro Lopez --- client/errors.go | 65 ++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/client/errors.go b/client/errors.go index 769b442..64144b6 100644 --- a/client/errors.go +++ b/client/errors.go @@ -1,85 +1,64 @@ package client import ( - "errors" "fmt" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" ) -// unwraps err using errors.Unwrap and returns the result. -func unwrapErr(err error) error { - for e := errors.Unwrap(err); e != nil; e = errors.Unwrap(err) { - err = e +// wrapsErrType returns true if any error in the error tree of err is of type E. +func wrapsErrType[E error](err error) bool { + switch e := err.(type) { + case E: + return true + case interface{ Unwrap() error }: + return wrapsErrType[E](e.Unwrap()) + case interface{ Unwrap() []error }: + for _, ei := range e.Unwrap() { + if wrapsErrType[E](ei) { + return true + } + } + return false + default: + return false } - - return err } // IsErrContainerNotFound checks if err corresponds to FrostFS status // return corresponding to missing container. Supports wrapped errors. func IsErrContainerNotFound(err error) bool { - switch unwrapErr(err).(type) { - default: - return false - case *apistatus.ContainerNotFound: - return true - } + return wrapsErrType[*apistatus.ContainerNotFound](err) } // IsErrEACLNotFound checks if err corresponds to FrostFS status // return corresponding to missing eACL table. Supports wrapped errors. func IsErrEACLNotFound(err error) bool { - switch unwrapErr(err).(type) { - default: - return false - case *apistatus.EACLNotFound: - return true - } + return wrapsErrType[*apistatus.EACLNotFound](err) } // IsErrObjectNotFound checks if err corresponds to FrostFS status // return corresponding to missing object. Supports wrapped errors. func IsErrObjectNotFound(err error) bool { - switch unwrapErr(err).(type) { - default: - return false - case *apistatus.ObjectNotFound: - return true - } + return wrapsErrType[*apistatus.ObjectNotFound](err) } // IsErrObjectAlreadyRemoved checks if err corresponds to FrostFS status // return corresponding to already removed object. Supports wrapped errors. func IsErrObjectAlreadyRemoved(err error) bool { - switch unwrapErr(err).(type) { - default: - return false - case *apistatus.ObjectAlreadyRemoved: - return true - } + return wrapsErrType[*apistatus.ObjectAlreadyRemoved](err) } // IsErrSessionExpired checks if err corresponds to FrostFS status return // corresponding to expired session. Supports wrapped errors. func IsErrSessionExpired(err error) bool { - switch unwrapErr(err).(type) { - default: - return false - case *apistatus.SessionTokenExpired: - return true - } + return wrapsErrType[*apistatus.SessionTokenExpired](err) } // IsErrSessionNotFound checks if err corresponds to FrostFS status return // corresponding to missing session. Supports wrapped errors. func IsErrSessionNotFound(err error) bool { - switch unwrapErr(err).(type) { - default: - return false - case *apistatus.SessionTokenNotFound: - return true - } + return wrapsErrType[*apistatus.SessionTokenNotFound](err) } // returns error describing missing field with the given name. From d48788c7a946895b40d9d6e8a1f91469b5cf2e98 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 9 Aug 2023 09:51:29 +0300 Subject: [PATCH 068/323] [#144] Bump required go version to go1.20 Signed-off-by: Evgenii Stratonikov --- Dockerfile | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb6b420..a4cfb15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19 +FROM golang:1.21 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-11-jre -y WORKDIR /work diff --git a/go.mod b/go.mod index 7c1690e..3ede75c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go -go 1.19 +go 1.20 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 From 548a81d3e6aaa4d607b9dc236c3a2bbaa7fec440 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 9 Aug 2023 09:48:05 +0300 Subject: [PATCH 069/323] [#48] client: Refactor accounting.Balance() Signed-off-by: Evgenii Stratonikov --- client/accounting.go | 92 ++++++++--------- client/common.go | 229 ------------------------------------------- 2 files changed, 46 insertions(+), 275 deletions(-) diff --git a/client/accounting.go b/client/accounting.go index 71dd030..021b26a 100644 --- a/client/accounting.go +++ b/client/accounting.go @@ -2,12 +2,16 @@ package client import ( "context" + "fmt" v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" ) @@ -26,6 +30,24 @@ func (x *PrmBalanceGet) SetAccount(id user.ID) { x.accountSet = true } +func (x *PrmBalanceGet) buildRequest(c *Client) (*v2accounting.BalanceRequest, error) { + if !x.accountSet { + return nil, errorAccountNotSet + } + + var accountV2 refs.OwnerID + x.account.WriteToV2(&accountV2) + + var body v2accounting.BalanceRequestBody + body.SetOwnerID(&accountV2) + + var req v2accounting.BalanceRequest + req.SetBody(&body) + + c.prepareRequest(&req, new(v2session.RequestMetaHeader)) + return &req, nil +} + // ResBalanceGet groups resulting values of BalanceGet operation. type ResBalanceGet struct { statusRes @@ -52,57 +74,35 @@ func (x ResBalanceGet) Amount() accounting.Decimal { // Return statuses: // - global (see Client docs). func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*ResBalanceGet, error) { - if !prm.accountSet { - return nil, errorAccountNotSet + req, err := prm.buildRequest(c) + if err != nil { + return nil, err } - // form request body - var accountV2 refs.OwnerID - prm.account.WriteToV2(&accountV2) - - var body v2accounting.BalanceRequestBody - body.SetOwnerID(&accountV2) - - // form request - var req v2accounting.BalanceRequest - - req.SetBody(&body) - - // init call context - - var ( - cc contextCall - res ResBalanceGet - ) - - c.initCallContext(&cc) - cc.meta = prm.prmCommonMeta - cc.req = &req - cc.statusRes = &res - cc.call = func() (responseV2, error) { - return rpcapi.Balance(&c.c, &req, client.WithContext(ctx)) - } - cc.result = func(r responseV2) { - resp := r.(*v2accounting.BalanceResponse) - - const fieldBalance = "balance" - - bal := resp.GetBody().GetBalance() - if bal == nil { - cc.err = newErrMissingResponseField(fieldBalance) - return - } - - cc.err = res.amount.ReadFromV2(*bal) - if cc.err != nil { - cc.err = newErrInvalidResponseField(fieldBalance, cc.err) - } + if err := signature.SignServiceMessage(&c.prm.key, req); err != nil { + return nil, fmt.Errorf("sign request: %w", err) } - // process call - if !cc.processCall() { - return nil, cc.err + resp, err := rpcapi.Balance(&c.c, req, client.WithContext(ctx)) + if err != nil { + return nil, err } + var res ResBalanceGet + res.st, err = c.processResponse(resp) + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err + } + + const fieldBalance = "balance" + + bal := resp.GetBody().GetBalance() + if bal == nil { + return &res, newErrMissingResponseField(fieldBalance) + } + + if err := res.amount.ReadFromV2(*bal); err != nil { + return &res, newErrInvalidResponseField(fieldBalance, err) + } return &res, nil } diff --git a/client/common.go b/client/common.go index 7449288..907f6be 100644 --- a/client/common.go +++ b/client/common.go @@ -1,7 +1,6 @@ package client import ( - "crypto/ecdsa" "errors" "fmt" @@ -13,21 +12,11 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" ) -// common interface of resulting structures with API status. -type resCommon interface { - setStatus(apistatus.Status) -} - // structure is embedded to all resulting types in order to inherit status-related methods. type statusRes struct { st apistatus.Status } -// setStatus implements resCommon interface method. -func (x *statusRes) setStatus(st apistatus.Status) { - x.st = st -} - // Status returns server's status return. // // Use apistatus package functionality to handle the status. @@ -85,89 +74,12 @@ var ( errorInvalidXHeaders = errors.New("xheaders must be presented only as key-value pairs") ) -// groups all the details required to send a single request and process a response to it. -type contextCall struct { - // ================================================== - // state vars that do not require explicit initialization - - // final error to be returned from client method - err error - - // received response - resp responseV2 - - // ================================================== - // shared parameters which are set uniformly on all calls - - // request signing key - key ecdsa.PrivateKey - - // callback prior to processing the response by the client - callbackResp func(ResponseMetaInfo) error - - // if set, protocol errors will be expanded into a final error - resolveAPIFailures bool - - // FrostFS network magic - netMagic uint64 - - // Meta parameters - meta prmCommonMeta - - // ================================================== - // custom call parameters - - // structure of the call result - statusRes resCommon - - // request to be signed with a key and sent - req request - - // function to send a request (unary) and receive a response - call func() (responseV2, error) - - // function to send the request (req field) - wReq func() error - - // function to recv the response (resp field) - rResp func() error - - // function to close the message stream - closer func() error - - // function of writing response fields to the resulting structure (optional) - result func(v2 responseV2) -} - type request interface { GetMetaHeader() *v2session.RequestMetaHeader SetMetaHeader(*v2session.RequestMetaHeader) SetVerificationHeader(*v2session.RequestVerificationHeader) } -// sets needed fields of the request meta header. -func (x contextCall) prepareRequest() { - meta := x.req.GetMetaHeader() - if meta == nil { - meta = new(v2session.RequestMetaHeader) - x.req.SetMetaHeader(meta) - } - - if meta.GetTTL() == 0 { - meta.SetTTL(2) - } - - if meta.GetVersion() == nil { - var verV2 refs.Version - version.Current().WriteToV2(&verV2) - meta.SetVersion(&verV2) - } - - meta.SetNetworkMagic(x.netMagic) - - writeXHeadersToMeta(x.meta.xHeaders, meta) -} - func (c *Client) prepareRequest(req request, meta *v2session.RequestMetaHeader) { ttl := meta.GetTTL() if ttl == 0 { @@ -187,75 +99,6 @@ func (c *Client) prepareRequest(req request, meta *v2session.RequestMetaHeader) req.SetMetaHeader(meta) } -// prepares, signs and writes the request. Result means success. -// If failed, contextCall.err contains the reason. -func (x *contextCall) writeRequest() bool { - x.prepareRequest() - - x.req.SetVerificationHeader(nil) - - // sign the request - x.err = signature.SignServiceMessage(&x.key, x.req) - if x.err != nil { - x.err = fmt.Errorf("sign request: %w", x.err) - return false - } - - x.err = x.wReq() - if x.err != nil { - x.err = fmt.Errorf("write request: %w", x.err) - return false - } - - return true -} - -// performs common actions of response processing and writes any problem as a result status or client error -// (in both cases returns false). -// -// Actions: -// - verify signature (internal); -// - call response callback (internal); -// - unwrap status error (optional). -func (x *contextCall) processResponse() bool { - // call response callback if set - if x.callbackResp != nil { - x.err = x.callbackResp(ResponseMetaInfo{ - key: x.resp.GetVerificationHeader().GetBodySignature().GetKey(), - epoch: x.resp.GetMetaHeader().GetEpoch(), - }) - if x.err != nil { - x.err = fmt.Errorf("response callback error: %w", x.err) - return false - } - } - - // note that we call response callback before signature check since it is expected more lightweight - // while verification needs marshaling - - // verify response signature - x.err = signature.VerifyServiceMessage(x.resp) - if x.err != nil { - x.err = fmt.Errorf("invalid response signature: %w", x.err) - return false - } - - // get result status - st := apistatus.FromStatusV2(x.resp.GetMetaHeader().GetStatus()) - - // unwrap unsuccessful status and return it - // as error if client has been configured so - successfulStatus := apistatus.IsSuccessful(st) - - if x.resolveAPIFailures { - x.err = apistatus.ErrFromStatus(st) - } else { - x.statusRes.setStatus(st) - } - - return successfulStatus -} - // processResponse verifies response signature and converts status to an error if needed. func (c *Client) processResponse(resp responseV2) (apistatus.Status, error) { if c.prm.cbRespInfo != nil { @@ -280,78 +123,6 @@ func (c *Client) processResponse(resp responseV2) (apistatus.Status, error) { return st, nil } -// reads response (if rResp is set) and processes it. Result means success. -// If failed, contextCall.err (or statusRes if resolveAPIFailures is set) contains the reason. -func (x *contextCall) readResponse() bool { - if x.rResp != nil { - x.err = x.rResp() - if x.err != nil { - x.err = fmt.Errorf("read response: %w", x.err) - return false - } - } - - return x.processResponse() -} - -// closes the message stream (if closer is set) and writes the results (if result is set). -// Return means success. If failed, contextCall.err contains the reason. -func (x *contextCall) close() bool { - if x.closer != nil { - x.err = x.closer() - if x.err != nil { - x.err = fmt.Errorf("close RPC: %w", x.err) - return false - } - } - - // write response to resulting structure - if x.result != nil { - x.result(x.resp) - } - - return x.err == nil -} - -// goes through all stages of sending a request and processing a response. Returns true if successful. -// If failed, contextCall.err contains the reason. -func (x *contextCall) processCall() bool { - // set request writer - x.wReq = func() error { - var err error - x.resp, err = x.call() - return err - } - - // write request - ok := x.writeRequest() - if !ok { - return false - } - - // read response - ok = x.readResponse() - if !ok { - return x.err == nil - } - - // close and write response to resulting structure - ok = x.close() - if !ok { - return false - } - - return x.err == nil -} - -// initializes static cross-call parameters inherited from client. -func (c *Client) initCallContext(ctx *contextCall) { - ctx.key = c.prm.key - ctx.resolveAPIFailures = c.prm.resolveFrostFSErrors - ctx.callbackResp = c.prm.cbRespInfo - ctx.netMagic = c.prm.netMagic -} - // ExecRaw executes f with underlying git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client.Client // instance. Communicate over the Protocol Buffers protocol in a more flexible way: // most often used to transmit data over a fixed version of the FrostFS protocol, as well From 03827857639916df3f998a91d647eb284b7d8026 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 11 Aug 2023 12:32:11 +0300 Subject: [PATCH 070/323] [#146] .forgejo: Update DCO action Signed-off-by: Evgenii Stratonikov --- .forgejo/workflows/dco.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml index d77461c..a5614a5 100644 --- a/.forgejo/workflows/dco.yml +++ b/.forgejo/workflows/dco.yml @@ -13,9 +13,9 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: '1.21' - name: Run commit format checker - uses: https://git.alexvan.in/alexvanin/dco-go@v1 + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v2 with: - from: 406c2324 + from: 'origin/${{ github.event.pull_request.base.ref }}' From 0314b326d31eb19d41bcb1dc59bc9215780ff654 Mon Sep 17 00:00:00 2001 From: Artem Tataurov Date: Tue, 15 Aug 2023 09:51:13 +0300 Subject: [PATCH 071/323] [#51] Add current nodes as external statistics Signed-off-by: Artem Tataurov --- pool/pool.go | 7 +++++++ pool/statistic.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/pool/pool.go b/pool/pool.go index 075ba7f..db3b298 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -2482,8 +2482,12 @@ func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decim func (p Pool) Statistic() Statistic { stat := Statistic{} for _, inner := range p.innerPools { + nodes := make([]string, 0, len(inner.clients)) inner.lock.RLock() for _, cl := range inner.clients { + if cl.isHealthy() { + nodes = append(nodes, cl.address()) + } node := NodeStatistic{ address: cl.address(), methods: cl.methodsStatus(), @@ -2494,6 +2498,9 @@ func (p Pool) Statistic() Statistic { stat.overallErrors += node.overallErrors } inner.lock.RUnlock() + if len(stat.currentNodes) == 0 { + stat.currentNodes = nodes + } } return stat diff --git a/pool/statistic.go b/pool/statistic.go index 3a4f424..5f1cfad 100644 --- a/pool/statistic.go +++ b/pool/statistic.go @@ -9,6 +9,7 @@ import ( type Statistic struct { overallErrors uint64 nodes []NodeStatistic + currentNodes []string } // OverallErrors returns sum of errors on all connections. It doesn't decrease. @@ -21,6 +22,12 @@ func (s Statistic) Nodes() []NodeStatistic { return s.nodes } +// CurrentNodes returns list of nodes of inner pool that has at least one healthy node. +// These nodes have the same and the highest priority among the other healthy nodes. +func (s Statistic) CurrentNodes() []string { + return s.currentNodes +} + // ErrUnknownNode indicate that node with current address is not found in list. var ErrUnknownNode = errors.New("unknown node") From a3b5d4d4f5c990605aba56b7bdbacb41ec671671 Mon Sep 17 00:00:00 2001 From: Artem Tataurov Date: Tue, 15 Aug 2023 09:51:40 +0300 Subject: [PATCH 072/323] [#51] Add node addresses as debug information Signed-off-by: Artem Tataurov --- pool/pool.go | 80 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index db3b298..901545c 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -2150,7 +2150,7 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) if err != nil { // removes session token from cache in case of token error p.checkSessionTokenErr(err, ctxCall.endpoint) - return id, fmt.Errorf("init writing on API client: %w", err) + return id, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err) } return id, nil @@ -2193,7 +2193,7 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error { return p.call(ctx, &cc, func() error { if err = cc.client.objectDelete(ctx, prm); err != nil { - return fmt.Errorf("remove object via client: %w", err) + return fmt.Errorf("remove object via client %s: %w", cc.endpoint, err) } return nil @@ -2244,7 +2244,10 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, e return res, p.call(ctx, &cc, func() error { res, err = cc.client.objectGet(ctx, prm) - return err + if err != nil { + return fmt.Errorf("get object via client %s: %w", cc.endpoint, err) + } + return nil }) } @@ -2266,7 +2269,10 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object return obj, p.call(ctx, &cc, func() error { obj, err = cc.client.objectHead(ctx, prm) - return err + if err != nil { + return fmt.Errorf("head object via client %s: %w", cc.endpoint, err) + } + return nil }) } @@ -2314,7 +2320,10 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRa return res, p.call(ctx, &cc, func() error { res, err = cc.client.objectRange(ctx, prm) - return err + if err != nil { + return fmt.Errorf("object range via client %s: %w", cc.endpoint, err) + } + return nil }) } @@ -2375,7 +2384,10 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjec return res, p.call(ctx, &cc, func() error { res, err = cc.client.objectSearch(ctx, prm) - return err + if err != nil { + return fmt.Errorf("search object via client %s: %w", cc.endpoint, err) + } + return nil }) } @@ -2395,7 +2407,12 @@ func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (cid.ID, e return cid.ID{}, err } - return cp.containerPut(ctx, prm) + cnrID, err := cp.containerPut(ctx, prm) + if err != nil { + return cid.ID{}, fmt.Errorf("put container via client '%s': %w", cp.address(), err) + } + + return cnrID, nil } // GetContainer reads FrostFS container by ID. @@ -2407,7 +2424,12 @@ func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container return container.Container{}, err } - return cp.containerGet(ctx, prm) + cnrs, err := cp.containerGet(ctx, prm) + if err != nil { + return container.Container{}, fmt.Errorf("get container via client '%s': %w", cp.address(), err) + } + + return cnrs, nil } // ListContainers requests identifiers of the account-owned containers. @@ -2417,7 +2439,12 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid. return nil, err } - return cp.containerList(ctx, prm) + cnrIDs, err := cp.containerList(ctx, prm) + if err != nil { + return []cid.ID{}, fmt.Errorf("list containers via client '%s': %w", cp.address(), err) + } + + return cnrIDs, nil } // DeleteContainer sends request to remove the FrostFS container and waits for the operation to complete. @@ -2434,7 +2461,12 @@ func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) erro return err } - return cp.containerDelete(ctx, prm) + err = cp.containerDelete(ctx, prm) + if err != nil { + return fmt.Errorf("delete container via client '%s': %w", cp.address(), err) + } + + return nil } // GetEACL reads eACL table of the FrostFS container. @@ -2446,7 +2478,12 @@ func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, e return eacl.Table{}, err } - return cp.containerEACL(ctx, prm) + eaclResult, err := cp.containerEACL(ctx, prm) + if err != nil { + return eacl.Table{}, fmt.Errorf("get EACL via client '%s': %w", cp.address(), err) + } + + return eaclResult, nil } // SetEACL sends request to update eACL table of the FrostFS container and waits for the operation to complete. @@ -2463,7 +2500,12 @@ func (p *Pool) SetEACL(ctx context.Context, prm PrmContainerSetEACL) error { return err } - return cp.containerSetEACL(ctx, prm) + err = cp.containerSetEACL(ctx, prm) + if err != nil { + return fmt.Errorf("set EACL via client '%s': %w", cp.address(), err) + } + + return nil } // Balance requests current balance of the FrostFS account. @@ -2475,7 +2517,12 @@ func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decim return accounting.Decimal{}, err } - return cp.balanceGet(ctx, prm) + balance, err := cp.balanceGet(ctx, prm) + if err != nil { + return accounting.Decimal{}, fmt.Errorf("get balance via client '%s': %w", cp.address(), err) + } + + return balance, nil } // Statistic returns connection statistics. @@ -2578,7 +2625,12 @@ func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error) { return netmap.NetworkInfo{}, err } - return cp.networkInfo(ctx, prmNetworkInfo{}) + netInfo, err := cp.networkInfo(ctx, prmNetworkInfo{}) + if err != nil { + return netmap.NetworkInfo{}, fmt.Errorf("get network info via client '%s': %w", cp.address(), err) + } + + return netInfo, nil } // Close closes the Pool and releases all the associated resources. From 3353940554526899f502868b456a0549dc25132c Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 11 Aug 2023 10:33:06 +0300 Subject: [PATCH 073/323] [#121] client: Make PrmContainerEACL fields public Signed-off-by: Airat Arifullin --- client/container_eacl.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/client/container_eacl.go b/client/container_eacl.go index 8f8e651..2acde86 100644 --- a/client/container_eacl.go +++ b/client/container_eacl.go @@ -17,26 +17,31 @@ import ( // PrmContainerEACL groups parameters of ContainerEACL operation. type PrmContainerEACL struct { - prmCommonMeta + // FrostFS request X-Headers. + XHeaders []string - idSet bool - id cid.ID + ContainerID *cid.ID } // SetContainer sets identifier of the FrostFS container to read the eACL table. // Required parameter. +// +// Deprecated: Use PrmContainerEACL.ContainerID instead. func (x *PrmContainerEACL) SetContainer(id cid.ID) { - x.id = id - x.idSet = true + x.ContainerID = &id } func (x *PrmContainerEACL) buildRequest(c *Client) (*v2container.GetExtendedACLRequest, error) { - if !x.idSet { + if x.ContainerID == nil { return nil, errorMissingContainer } + if len(x.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + var cidV2 refs.ContainerID - x.id.WriteToV2(&cidV2) + x.ContainerID.WriteToV2(&cidV2) reqBody := new(v2container.GetExtendedACLRequestBody) reqBody.SetContainerID(&cidV2) From 6fdbe755179efb5fc5cdf5f1abc78cb4e982c3c8 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 11 Aug 2023 11:06:45 +0300 Subject: [PATCH 074/323] [#121] pool: Make PrmContainerEACL fields public Signed-off-by: Airat Arifullin --- pool/pool.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 901545c..b603951 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -523,8 +523,9 @@ func (c *clientWrapper) containerEACL(ctx context.Context, prm PrmContainerEACL) return eacl.Table{}, err } - var cliPrm sdkClient.PrmContainerEACL - cliPrm.SetContainer(prm.cnrID) + cliPrm := sdkClient.PrmContainerEACL{ + ContainerID: &prm.ContainerID, + } start := time.Now() res, err := cl.ContainerEACL(ctx, cliPrm) @@ -1521,12 +1522,12 @@ func (x *PrmContainerDelete) SetWaitParams(waitParams WaitParams) { // PrmContainerEACL groups parameters of GetEACL operation. type PrmContainerEACL struct { - cnrID cid.ID + ContainerID cid.ID } // SetContainerID specifies identifier of the FrostFS container to read the eACL table. func (x *PrmContainerEACL) SetContainerID(cnrID cid.ID) { - x.cnrID = cnrID + x.ContainerID = cnrID } // PrmContainerSetEACL groups parameters of SetEACL operation. @@ -2568,7 +2569,7 @@ func waitForContainerPresence(ctx context.Context, cli client, cnrID cid.ID, wai func waitForEACLPresence(ctx context.Context, cli client, cnrID *cid.ID, table *eacl.Table, waitParams *WaitParams) error { var prm PrmContainerEACL if cnrID != nil { - prm.SetContainerID(*cnrID) + prm.ContainerID = *cnrID } return waitFor(ctx, waitParams, func(ctx context.Context) bool { From 22978303f8b7e4123a54a87966caa2d7aceb25a1 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 18 Aug 2023 17:54:51 +0300 Subject: [PATCH 075/323] [#121] clientt: Make PrmContainerSetEACL fields public Signed-off-by: Airat Arifullin --- client/container_set_eacl.go | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/client/container_set_eacl.go b/client/container_set_eacl.go index 1917373..0ea89aa 100644 --- a/client/container_set_eacl.go +++ b/client/container_set_eacl.go @@ -18,20 +18,20 @@ import ( // PrmContainerSetEACL groups parameters of ContainerSetEACL operation. type PrmContainerSetEACL struct { - prmCommonMeta + // FrostFS request X-Headers. + XHeaders []string - tableSet bool - table eacl.Table + Table *eacl.Table - sessionSet bool - session session.Container + Session *session.Container } // SetTable sets eACL table structure to be set for the container. // Required parameter. +// +// Deprecated: Use PrmContainerSetEACL.Table instead. func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { - x.table = table - x.tableSet = true + x.Table = &table } // WithinSession specifies session within which extended ACL of the container @@ -45,17 +45,22 @@ func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { // for which extended ACL is going to be set // - session operation MUST be session.VerbContainerSetEACL (ForVerb) // - token MUST be signed using private key of the owner of the container to be saved +// +// Deprecated: Use PrmContainerSetEACL.Session instead. func (x *PrmContainerSetEACL) WithinSession(s session.Container) { - x.session = s - x.sessionSet = true + x.Session = &s } func (x *PrmContainerSetEACL) buildRequest(c *Client) (*v2container.SetExtendedACLRequest, error) { - if !x.tableSet { + if x.Table == nil { return nil, errorEACLTableNotSet } - eaclV2 := x.table.ToV2() + if len(x.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + eaclV2 := x.Table.ToV2() var sig frostfscrypto.Signature @@ -72,11 +77,11 @@ func (x *PrmContainerSetEACL) buildRequest(c *Client) (*v2container.SetExtendedA reqBody.SetSignature(&sigv2) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.prmCommonMeta.xHeaders, &meta) + writeXHeadersToMeta(x.XHeaders, &meta) - if x.sessionSet { + if x.Session != nil { var tokv2 v2session.Token - x.session.WriteToV2(&tokv2) + x.Session.WriteToV2(&tokv2) meta.SetSessionToken(&tokv2) } From 342524159ac33b9bc01df3696ebb151538acd581 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 18 Aug 2023 18:07:51 +0300 Subject: [PATCH 076/323] [#121] pool: Make PrmContainerSetEACL fields public Signed-off-by: Airat Arifullin --- pool/pool.go | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index b603951..06c317c 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -549,11 +549,9 @@ func (c *clientWrapper) containerSetEACL(ctx context.Context, prm PrmContainerSe return err } - var cliPrm sdkClient.PrmContainerSetEACL - cliPrm.SetTable(prm.table) - - if prm.sessionSet { - cliPrm.WithinSession(prm.session) + cliPrm := sdkClient.PrmContainerSetEACL{ + Table: &prm.Table, + Session: prm.Session, } start := time.Now() @@ -567,16 +565,19 @@ func (c *clientWrapper) containerSetEACL(ctx context.Context, prm PrmContainerSe return fmt.Errorf("set eacl on client: %w", err) } - if !prm.waitParamsSet { - prm.waitParams.setDefaults() + if prm.WaitParams == nil { + prm.WaitParams = defaultWaitParams() + } + if err := prm.WaitParams.CheckValidity(); err != nil { + return fmt.Errorf("invalid wait parameters: %w", err) } var cIDp *cid.ID - if cID, set := prm.table.CID(); set { + if cID, set := prm.Table.CID(); set { cIDp = &cID } - err = waitForEACLPresence(ctx, c, cIDp, &prm.table, &prm.waitParams) + err = waitForEACLPresence(ctx, c, cIDp, &prm.Table, prm.WaitParams) if err = c.handleError(ctx, nil, err); err != nil { return fmt.Errorf("wait eacl presence on client: %w", err) } @@ -1227,12 +1228,6 @@ func (x *WaitParams) SetPollInterval(tick time.Duration) { x.PollInterval = tick } -// Deprecated: Use defaultWaitParams() instead. -func (x *WaitParams) setDefaults() { - x.Timeout = 120 * time.Second - x.PollInterval = 5 * time.Second -} - func defaultWaitParams() *WaitParams { return &WaitParams{ Timeout: 120 * time.Second, @@ -1532,39 +1527,41 @@ func (x *PrmContainerEACL) SetContainerID(cnrID cid.ID) { // PrmContainerSetEACL groups parameters of SetEACL operation. type PrmContainerSetEACL struct { - table eacl.Table + Table eacl.Table - sessionSet bool - session session.Container + Session *session.Container - waitParams WaitParams - waitParamsSet bool + WaitParams *WaitParams } // SetTable sets structure of container's extended ACL to be used as a // parameter of the base client's operation. // // See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerSetEACL.SetTable. +// +// Deprecated: Use PrmContainerSetEACL.Table instead. func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { - x.table = table + x.Table = table } // WithinSession specifies session to be used as a parameter of the base // client's operation. // // See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerSetEACL.WithinSession. +// +// Deprecated: Use PrmContainerSetEACL.Session instead. func (x *PrmContainerSetEACL) WithinSession(s session.Container) { - x.session = s - x.sessionSet = true + x.Session = &s } // SetWaitParams specifies timeout params to complete operation. // If not provided the default one will be used. // Panics if any of the wait params isn't positive. +// +// Deprecated: Use PrmContainerSetEACL.WaitParams instead. func (x *PrmContainerSetEACL) SetWaitParams(waitParams WaitParams) { waitParams.checkForPositive() - x.waitParams = waitParams - x.waitParamsSet = true + x.WaitParams = &waitParams } // PrmBalanceGet groups parameters of Balance operation. From 518fb79bc0b7e801d30f430bd955dbed88c1f148 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 11 Jul 2023 12:02:23 +0300 Subject: [PATCH 077/323] [#114] pool: Support client cut with memory limiter Signed-off-by: Denis Kirillov --- pool/cache.go | 4 + pool/object_put_transformer.go | 107 +++++++++++++++++ pool/parts_buffer_pool.go | 64 ++++++++++ pool/pool.go | 207 +++++++++++++++++++++++++++++---- pool/pool_test.go | 22 ++-- 5 files changed, 370 insertions(+), 34 deletions(-) create mode 100644 pool/object_put_transformer.go create mode 100644 pool/parts_buffer_pool.go diff --git a/pool/cache.go b/pool/cache.go index 1614e8a..5c39888 100644 --- a/pool/cache.go +++ b/pool/cache.go @@ -69,3 +69,7 @@ func (c *sessionCache) expired(val *cacheValue) bool { // use epoch+1 (clear cache beforehand) to prevent 'expired session token' error right after epoch tick return val.token.ExpiredAt(epoch + 1) } + +func (c *sessionCache) Epoch() uint64 { + return c.currentEpoch.Load() +} diff --git a/pool/object_put_transformer.go b/pool/object_put_transformer.go new file mode 100644 index 0000000..74c88c3 --- /dev/null +++ b/pool/object_put_transformer.go @@ -0,0 +1,107 @@ +package pool + +import ( + "context" + "crypto/ecdsa" + + sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" +) + +type PrmObjectPutClientCutInit struct { + sdkClient.PrmObjectPutInit + key *ecdsa.PrivateKey + maxSize uint64 + epochSource transformer.EpochSource + withoutHomomorphicHash bool + stoken *session.Object +} + +func (c *clientWrapper) objectPutInitTransformer(prm PrmObjectPutClientCutInit) (*objectWriterTransformer, error) { + var w objectWriterTransformer + w.it = internalTarget{ + client: c.client, + prm: prm, + } + key := &c.prm.key + if prm.key != nil { + key = prm.key + } + + w.ot = transformer.NewPayloadSizeLimiter(transformer.Params{ + Key: key, + NextTargetInit: func() transformer.ObjectWriter { return &w.it }, + MaxSize: prm.maxSize, + WithoutHomomorphicHash: prm.withoutHomomorphicHash, + NetworkState: prm.epochSource, + SessionToken: prm.stoken, + }) + return &w, nil +} + +type objectWriterTransformer struct { + ot transformer.ChunkedObjectWriter + it internalTarget + err error +} + +func (x *objectWriterTransformer) WriteHeader(ctx context.Context, hdr object.Object) bool { + x.err = x.ot.WriteHeader(ctx, &hdr) + return x.err == nil +} + +func (x *objectWriterTransformer) WritePayloadChunk(ctx context.Context, chunk []byte) bool { + _, x.err = x.ot.Write(ctx, chunk) + return x.err == nil +} + +// ResObjectPut groups the final result values of ObjectPutInit operation. +type ResObjectPut struct { + Status apistatus.Status + OID oid.ID +} + +func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, error) { + ai, err := x.ot.Close(ctx) + if err != nil { + return nil, err + } + + if ai != nil && ai.ParentID != nil { + x.it.res.OID = *ai.ParentID + } + return &x.it.res, nil +} + +type internalTarget struct { + client *sdkClient.Client + res ResObjectPut + prm PrmObjectPutClientCutInit + useStream bool +} + +func (it *internalTarget) WriteObject(ctx context.Context, o *object.Object) error { + // todo support PutSingle + it.useStream = true + return it.putAsStream(ctx, o) +} + +func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) error { + wrt, err := it.client.ObjectPutInit(ctx, it.prm.PrmObjectPutInit) + if err != nil { + return err + } + if wrt.WriteHeader(ctx, *o) { + wrt.WritePayloadChunk(ctx, o.Payload()) + } + res, err := wrt.Close(ctx) + if res != nil { + it.res.Status = res.Status() + it.res.OID = res.StoredObjectID() + } + return err +} diff --git a/pool/parts_buffer_pool.go b/pool/parts_buffer_pool.go new file mode 100644 index 0000000..b204f50 --- /dev/null +++ b/pool/parts_buffer_pool.go @@ -0,0 +1,64 @@ +package pool + +import ( + "fmt" + "sync" +) + +type PartBuffer struct { + Buffer []byte + len uint64 +} + +type PartsBufferPool struct { + syncPool *sync.Pool + limit uint64 + maxObjectSize uint64 + + mu sync.Mutex + available uint64 +} + +func NewPartBufferPool(limit uint64, maxObjectSize uint64) *PartsBufferPool { + return &PartsBufferPool{ + limit: limit, + maxObjectSize: maxObjectSize, + available: limit, + syncPool: &sync.Pool{New: func() any { return make([]byte, maxObjectSize) }}, + } +} + +func (p *PartsBufferPool) ParBufferSize() uint64 { + return p.maxObjectSize +} + +func (p *PartsBufferPool) GetBuffer() (*PartBuffer, error) { + p.mu.Lock() + defer p.mu.Unlock() + + if p.maxObjectSize > p.available { + return nil, fmt.Errorf("requested buffer size %d is greater than available: %d", p.maxObjectSize, p.available) + } + + p.available -= p.maxObjectSize + + return &PartBuffer{ + Buffer: p.syncPool.Get().([]byte), + len: p.maxObjectSize, + }, nil +} + +func (p *PartsBufferPool) FreeBuffer(buff *PartBuffer) error { + p.mu.Lock() + defer p.mu.Unlock() + + used := p.limit - p.available + if buff.len > used { + return fmt.Errorf("buffer size %d to free is greater than used: %d", buff.len, used) + } + + p.available += buff.len + p.syncPool.Put(buff.Buffer) + + return nil +} diff --git a/pool/pool.go b/pool/pool.go index 06c317c..550c1fc 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -629,6 +629,14 @@ func (c *clientWrapper) networkInfo(ctx context.Context, _ prmNetworkInfo) (netm // objectPut writes object to FrostFS. func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { + if prm.clientCut { + return c.objectPutClientCut(ctx, prm) + } + + return c.objectPutServerCut(ctx, prm) +} + +func (c *clientWrapper) objectPutServerCut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { cl, err := c.getClient() if err != nil { return oid.ID{}, err @@ -710,6 +718,80 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID return res.StoredObjectID(), nil } +func (c *clientWrapper) objectPutClientCut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { + var cliPrm sdkClient.PrmObjectPutInit + cliPrm.SetCopiesNumberByVectors(prm.copiesNumber) + if prm.stoken != nil { + cliPrm.WithinSession(*prm.stoken) + } + if prm.key != nil { + cliPrm.UseKey(*prm.key) + } + if prm.btoken != nil { + cliPrm.WithBearerToken(*prm.btoken) + } + + putInitPrm := PrmObjectPutClientCutInit{ + PrmObjectPutInit: cliPrm, + key: prm.key, + maxSize: prm.networkInfo.MaxObjectSize(), + epochSource: prm.networkInfo, + stoken: prm.stoken, + } + + start := time.Now() + wObj, err := c.objectPutInitTransformer(putInitPrm) + c.incRequests(time.Since(start), methodObjectPut) + if err = c.handleError(ctx, nil, err); err != nil { + return oid.ID{}, fmt.Errorf("init writing on API client: %w", err) + } + + if wObj.WriteHeader(ctx, prm.hdr) { + if data := prm.hdr.Payload(); len(data) > 0 { + if prm.payload != nil { + prm.payload = io.MultiReader(bytes.NewReader(data), prm.payload) + } else { + prm.payload = bytes.NewReader(data) + } + } + + if prm.payload != nil { + var n int + + for { + n, err = prm.payload.Read(prm.partBuffer) + if n > 0 { + start = time.Now() + successWrite := wObj.WritePayloadChunk(ctx, prm.partBuffer[:n]) + c.incRequests(time.Since(start), methodObjectPut) + if !successWrite { + break + } + + continue + } + + if errors.Is(err, io.EOF) { + break + } + + return oid.ID{}, fmt.Errorf("read payload: %w", c.handleError(ctx, nil, err)) + } + } + } + + res, err := wObj.Close(ctx) + var st apistatus.Status + if res != nil { + st = res.Status + } + if err = c.handleError(ctx, st, err); err != nil { // here err already carries both status and client errors + return oid.ID{}, fmt.Errorf("client failure: %w", err) + } + + return res.OID, nil +} + // objectDelete invokes sdkClient.ObjectDelete parse response status to error. func (c *clientWrapper) objectDelete(ctx context.Context, prm PrmObjectDelete) error { cl, err := c.getClient() @@ -1072,6 +1154,7 @@ type InitParameters struct { nodeParams []NodeParam requestCallback func(RequestInfo) dialOptions []grpc.DialOption + maxClientCutMemory uint64 clientBuilder clientBuilder } @@ -1136,6 +1219,14 @@ func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption) { x.dialOptions = opts } +// SetMaxClientCutMemory sets the max amount of bytes that can be used during client cut (see PrmObjectPut.SetClientCut). +// Default value is 1gb (that should be enough for 200 concurrent PUT request for MaxObjectSize 50mb). +// If the MaxObjectSize network param is greater than limit is set by this method +// Pool.PutObject operations with PrmObjectPut.SetClientCut will fail. +func (x *InitParameters) SetMaxClientCutMemory(size uint64) { + x.maxClientCutMemory = size +} + // setClientBuilder sets clientBuilder used for client construction. // Wraps setClientBuilderContext without a context. func (x *InitParameters) setClientBuilder(builder clientBuilder) { @@ -1316,6 +1407,10 @@ type PrmObjectPut struct { payload io.Reader copiesNumber []uint32 + + clientCut bool + partBuffer []byte + networkInfo netmap.NetworkInfo } // SetHeader specifies header of the object. @@ -1340,6 +1435,24 @@ func (x *PrmObjectPut) SetCopiesNumberVector(copiesNumber []uint32) { x.copiesNumber = copiesNumber } +// SetClientCut enables client cut for objects. It means that full object is prepared on client side +// and retrying is possible. But this leads to additional memory using for buffering object parts. +// Buffer size for every put is MaxObjectSize value from FrostFS network. +// There is limit for total memory allocation for in-flight request and +// can be set by InitParameters.SetMaxClientCutMemory (default value is 1gb). +// Put requests will fail if this limit be reached. +func (x *PrmObjectPut) SetClientCut(clientCut bool) { + x.clientCut = clientCut +} + +func (x *PrmObjectPut) setPartBuffer(partBuffer []byte) { + x.partBuffer = partBuffer +} + +func (x *PrmObjectPut) setNetworkInfo(ni netmap.NetworkInfo) { + x.networkInfo = ni +} + // PrmObjectDelete groups parameters of DeleteObject operation. type PrmObjectDelete struct { prmCommon @@ -1635,6 +1748,11 @@ type Pool struct { rebalanceParams rebalanceParameters clientBuilder clientBuilder logger *zap.Logger + + // we cannot initialize partBufferPool in NewPool function, + // so we have to save maxClientCutMemory param for further initialization in Dial. + maxClientCutMemory uint64 + partsBufferPool *PartsBufferPool } type innerPool struct { @@ -1646,6 +1764,7 @@ type innerPool struct { const ( defaultSessionTokenExpirationDuration = 100 // in blocks defaultErrorThreshold = 100 + defaultMaxClientCutMemory = 1024 * 1024 * 1024 // 1gb defaultRebalanceInterval = 15 * time.Second defaultHealthcheckTimeout = 4 * time.Second @@ -1682,7 +1801,8 @@ func NewPool(options InitParameters) (*Pool, error) { clientRebalanceInterval: options.clientRebalanceInterval, sessionExpirationDuration: options.sessionExpirationDuration, }, - clientBuilder: options.clientBuilder, + clientBuilder: options.clientBuilder, + maxClientCutMemory: options.maxClientCutMemory, } return pool, nil @@ -1710,7 +1830,7 @@ func (p *Pool) Dial(ctx context.Context) error { } var st session.Object - err := initSessionForDuration(ctx, &st, clients[j], p.rebalanceParams.sessionExpirationDuration, *p.key) + err := initSessionForDuration(ctx, &st, clients[j], p.rebalanceParams.sessionExpirationDuration, *p.key, false) if err != nil { clients[j].setUnhealthy() p.log(zap.WarnLevel, "failed to create frostfs session token for client", @@ -1718,7 +1838,7 @@ func (p *Pool) Dial(ctx context.Context) error { continue } - _ = p.cache.Put(formCacheKey(addr, p.key), st) + _ = p.cache.Put(formCacheKey(addr, p.key, false), st) atLeastOneHealthy = true } source := rand.NewSource(time.Now().UnixNano()) @@ -1739,6 +1859,12 @@ func (p *Pool) Dial(ctx context.Context) error { p.closedCh = make(chan struct{}) p.innerPools = inner + ni, err := p.NetworkInfo(ctx) + if err != nil { + return fmt.Errorf("get network info for max object size: %w", err) + } + p.partsBufferPool = NewPartBufferPool(p.maxClientCutMemory, ni.MaxObjectSize()) + go p.startRebalance(ctx) return nil } @@ -1760,6 +1886,10 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { params.errorThreshold = defaultErrorThreshold } + if params.maxClientCutMemory == 0 { + params.maxClientCutMemory = defaultMaxClientCutMemory + } + if params.clientRebalanceInterval <= 0 { params.clientRebalanceInterval = defaultRebalanceInterval } @@ -1949,9 +2079,15 @@ func (p *innerPool) connection() (client, error) { return nil, errors.New("no healthy client") } -func formCacheKey(address string, key *ecdsa.PrivateKey) string { +func formCacheKey(address string, key *ecdsa.PrivateKey, clientCut bool) string { k := keys.PrivateKey{PrivateKey: *key} - return address + k.String() + + stype := "server" + if clientCut { + stype = "client" + } + + return address + stype + k.String() } func (p *Pool) checkSessionTokenErr(err error, address string) bool { @@ -1967,7 +2103,7 @@ func (p *Pool) checkSessionTokenErr(err error, address string) bool { return false } -func initSessionForDuration(ctx context.Context, dst *session.Object, c client, dur uint64, ownerKey ecdsa.PrivateKey) error { +func initSessionForDuration(ctx context.Context, dst *session.Object, c client, dur uint64, ownerKey ecdsa.PrivateKey, clientCut bool) error { ni, err := c.networkInfo(ctx, prmNetworkInfo{}) if err != nil { return err @@ -1985,23 +2121,26 @@ func initSessionForDuration(ctx context.Context, dst *session.Object, c client, prm.setExp(exp) prm.useKey(ownerKey) - res, err := c.sessionCreate(ctx, prm) - if err != nil { - return err - } + var ( + id uuid.UUID + key frostfsecdsa.PublicKey + ) - var id uuid.UUID + if clientCut { + id = uuid.New() + key = frostfsecdsa.PublicKey(ownerKey.PublicKey) - err = id.UnmarshalBinary(res.id) - if err != nil { - return fmt.Errorf("invalid session token ID: %w", err) - } - - var key frostfsecdsa.PublicKey - - err = key.Decode(res.sessionKey) - if err != nil { - return fmt.Errorf("invalid public session key: %w", err) + } else { + res, err := c.sessionCreate(ctx, prm) + if err != nil { + return err + } + if err = id.UnmarshalBinary(res.id); err != nil { + return fmt.Errorf("invalid session token ID: %w", err) + } + if err = key.Decode(res.sessionKey); err != nil { + return fmt.Errorf("invalid public session key: %w", err) + } } dst.SetID(id) @@ -2027,6 +2166,8 @@ type callContext struct { sessionCnr cid.ID sessionObjSet bool sessionObjs []oid.ID + + sessionClientCut bool } func (p *Pool) initCallContext(ctx *callContext, cfg prmCommon, prmCtx prmContext) error { @@ -2063,12 +2204,12 @@ func (p *Pool) initCallContext(ctx *callContext, cfg prmCommon, prmCtx prmContex // opens new session or uses cached one. // Must be called only on initialized callContext with set sessionTarget. func (p *Pool) openDefaultSession(ctx context.Context, cc *callContext) error { - cacheKey := formCacheKey(cc.endpoint, cc.key) + cacheKey := formCacheKey(cc.endpoint, cc.key, cc.sessionClientCut) tok, ok := p.cache.Get(cacheKey) if !ok { // init new session - err := initSessionForDuration(ctx, &tok, cc.client, p.stokenDuration, *cc.key) + err := initSessionForDuration(ctx, &tok, cc.client, p.stokenDuration, *cc.key, cc.sessionClientCut) if err != nil { return fmt.Errorf("session API client: %w", err) } @@ -2133,6 +2274,7 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) p.fillAppropriateKey(&prm.prmCommon) var ctxCall callContext + ctxCall.sessionClientCut = prm.clientCut if err := p.initCallContext(&ctxCall, prm.prmCommon, prmCtx); err != nil { return oid.ID{}, fmt.Errorf("init call context: %w", err) } @@ -2144,6 +2286,25 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) } } + buff, err := p.partsBufferPool.GetBuffer() + if err != nil { + return oid.ID{}, fmt.Errorf("cannot get buffer for put operations: %w", err) + } + + defer func() { + if errFree := p.partsBufferPool.FreeBuffer(buff); errFree != nil { + p.log(zap.WarnLevel, "failed to free part buffer", zap.Error(err)) + } + }() + + prm.setPartBuffer(buff.Buffer) + + var ni netmap.NetworkInfo + ni.SetCurrentEpoch(p.cache.Epoch()) + ni.SetMaxObjectSize(p.partsBufferPool.ParBufferSize()) // we want to use initial max object size in PayloadSizeLimiter + + prm.setNetworkInfo(ni) + id, err := ctxCall.client.objectPut(ctx, prm) if err != nil { // removes session token from cache in case of token error diff --git a/pool/pool_test.go b/pool/pool_test.go index 08de667..bd1c1eb 100644 --- a/pool/pool_test.go +++ b/pool/pool_test.go @@ -106,7 +106,7 @@ func TestBuildPoolOneNodeFailed(t *testing.T) { if err != nil { return false } - st, _ := clientPool.cache.Get(formCacheKey(cp.address(), clientPool.key)) + st, _ := clientPool.cache.Get(formCacheKey(cp.address(), clientPool.key, false)) return st.AssertAuthKey(&expectedAuthKey) } require.Never(t, condition, 900*time.Millisecond, 100*time.Millisecond) @@ -141,7 +141,7 @@ func TestOneNode(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) expectedAuthKey := frostfsecdsa.PublicKey(key1.PublicKey) require.True(t, st.AssertAuthKey(&expectedAuthKey)) } @@ -171,7 +171,7 @@ func TestTwoNodes(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, assertAuthKeyForAny(st, clientKeys)) } @@ -226,7 +226,7 @@ func TestOneOfTwoFailed(t *testing.T) { for i := 0; i < 5; i++ { cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, assertAuthKeyForAny(st, clientKeys)) } } @@ -296,7 +296,7 @@ func TestSessionCache(t *testing.T) { // cache must contain session token cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) var prm PrmObjectGet @@ -309,7 +309,7 @@ func TestSessionCache(t *testing.T) { // cache must not contain session token cp, err = pool.connection() require.NoError(t, err) - _, ok := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + _, ok := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.False(t, ok) var prm2 PrmObjectPut @@ -321,7 +321,7 @@ func TestSessionCache(t *testing.T) { // cache must contain session token cp, err = pool.connection() require.NoError(t, err) - st, _ = pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ = pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) } @@ -365,7 +365,7 @@ func TestPriority(t *testing.T) { firstNode := func() bool { cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) return st.AssertAuthKey(&expectedAuthKey1) } @@ -373,7 +373,7 @@ func TestPriority(t *testing.T) { secondNode := func() bool { cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) return st.AssertAuthKey(&expectedAuthKey2) } require.Never(t, secondNode, time.Second, 200*time.Millisecond) @@ -410,7 +410,7 @@ func TestSessionCacheWithKey(t *testing.T) { // cache must contain session token cp, err := pool.connection() require.NoError(t, err) - st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key)) + st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) var prm PrmObjectDelete @@ -420,7 +420,7 @@ func TestSessionCacheWithKey(t *testing.T) { err = pool.DeleteObject(ctx, prm) require.NoError(t, err) - st, _ = pool.cache.Get(formCacheKey(cp.address(), anonKey)) + st, _ = pool.cache.Get(formCacheKey(cp.address(), anonKey, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) } From cae215534fcaea04992c2f6eb9d4a744f5f14e94 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 14 Jul 2023 12:24:49 +0300 Subject: [PATCH 078/323] [#114] pool: Fix linter errors Signed-off-by: Denis Kirillov --- pool/parts_buffer_pool.go | 12 +++++++++--- pool/pool.go | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pool/parts_buffer_pool.go b/pool/parts_buffer_pool.go index b204f50..d02de66 100644 --- a/pool/parts_buffer_pool.go +++ b/pool/parts_buffer_pool.go @@ -24,7 +24,13 @@ func NewPartBufferPool(limit uint64, maxObjectSize uint64) *PartsBufferPool { limit: limit, maxObjectSize: maxObjectSize, available: limit, - syncPool: &sync.Pool{New: func() any { return make([]byte, maxObjectSize) }}, + syncPool: &sync.Pool{New: func() any { + // We have to use pointer (even for slices), see https://staticcheck.dev/docs/checks/#SA6002 + // It's based on interfaces implementation in 2016, so maybe something has changed since then. + // We can use no pointer for multi-kilobyte slices though https://github.com/golang/go/issues/16323#issuecomment-254401036 + buff := make([]byte, maxObjectSize) + return &buff + }}, } } @@ -43,7 +49,7 @@ func (p *PartsBufferPool) GetBuffer() (*PartBuffer, error) { p.available -= p.maxObjectSize return &PartBuffer{ - Buffer: p.syncPool.Get().([]byte), + Buffer: *p.syncPool.Get().(*[]byte), len: p.maxObjectSize, }, nil } @@ -58,7 +64,7 @@ func (p *PartsBufferPool) FreeBuffer(buff *PartBuffer) error { } p.available += buff.len - p.syncPool.Put(buff.Buffer) + p.syncPool.Put(&buff.Buffer) return nil } diff --git a/pool/pool.go b/pool/pool.go index 550c1fc..8c0530c 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -2129,7 +2129,6 @@ func initSessionForDuration(ctx context.Context, dst *session.Object, c client, if clientCut { id = uuid.New() key = frostfsecdsa.PublicKey(ownerKey.PublicKey) - } else { res, err := c.sessionCreate(ctx, prm) if err != nil { From faeeeab87a1ee734297ef81ee8e1ffa701fff1ae Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 14 Jul 2023 15:23:28 +0300 Subject: [PATCH 079/323] [#114] pool: Don't use part buffers when client cut is off Signed-off-by: Denis Kirillov --- pool/parts_buffer_pool.go | 5 ++--- pool/pool.go | 30 ++++++++++++++++-------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/pool/parts_buffer_pool.go b/pool/parts_buffer_pool.go index d02de66..828d859 100644 --- a/pool/parts_buffer_pool.go +++ b/pool/parts_buffer_pool.go @@ -58,9 +58,8 @@ func (p *PartsBufferPool) FreeBuffer(buff *PartBuffer) error { p.mu.Lock() defer p.mu.Unlock() - used := p.limit - p.available - if buff.len > used { - return fmt.Errorf("buffer size %d to free is greater than used: %d", buff.len, used) + if buff.len+p.available > p.limit { + return fmt.Errorf("buffer size %d to free is too large, available: %d, limit: %d", buff.len, p.available, p.limit) } p.available += buff.len diff --git a/pool/pool.go b/pool/pool.go index 8c0530c..a3f3b45 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -2285,24 +2285,26 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) } } - buff, err := p.partsBufferPool.GetBuffer() - if err != nil { - return oid.ID{}, fmt.Errorf("cannot get buffer for put operations: %w", err) - } - - defer func() { - if errFree := p.partsBufferPool.FreeBuffer(buff); errFree != nil { - p.log(zap.WarnLevel, "failed to free part buffer", zap.Error(err)) + if prm.clientCut { + buff, err := p.partsBufferPool.GetBuffer() + if err != nil { + return oid.ID{}, fmt.Errorf("cannot get buffer for put operations: %w", err) } - }() - prm.setPartBuffer(buff.Buffer) + prm.setPartBuffer(buff.Buffer) - var ni netmap.NetworkInfo - ni.SetCurrentEpoch(p.cache.Epoch()) - ni.SetMaxObjectSize(p.partsBufferPool.ParBufferSize()) // we want to use initial max object size in PayloadSizeLimiter + var ni netmap.NetworkInfo + ni.SetCurrentEpoch(p.cache.Epoch()) + ni.SetMaxObjectSize(p.partsBufferPool.ParBufferSize()) // we want to use initial max object size in PayloadSizeLimiter - prm.setNetworkInfo(ni) + prm.setNetworkInfo(ni) + + defer func() { + if errFree := p.partsBufferPool.FreeBuffer(buff); errFree != nil { + p.log(zap.WarnLevel, "failed to free part buffer", zap.Error(err)) + } + }() + } id, err := ctxCall.client.objectPut(ctx, prm) if err != nil { From 3cb38410737aedaaa77554129901c07cef0eb817 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 1 Aug 2023 11:50:18 +0300 Subject: [PATCH 080/323] [#115] pool: Try putSingle if possible Signed-off-by: Denis Kirillov --- pool/object_put_transformer.go | 98 ++++++++++++++++++++++++++++------ pool/pool.go | 36 ++++++------- 2 files changed, 98 insertions(+), 36 deletions(-) diff --git a/pool/object_put_transformer.go b/pool/object_put_transformer.go index 74c88c3..08d41dd 100644 --- a/pool/object_put_transformer.go +++ b/pool/object_put_transformer.go @@ -2,30 +2,39 @@ package pool import ( "context" - "crypto/ecdsa" sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) +type logger interface { + log(level zapcore.Level, msg string, fields ...zap.Field) +} + type PrmObjectPutClientCutInit struct { - sdkClient.PrmObjectPutInit - key *ecdsa.PrivateKey - maxSize uint64 - epochSource transformer.EpochSource + PrmObjectPut withoutHomomorphicHash bool - stoken *session.Object } func (c *clientWrapper) objectPutInitTransformer(prm PrmObjectPutClientCutInit) (*objectWriterTransformer, error) { + cl, err := c.getClient() + if err != nil { + return nil, err + } var w objectWriterTransformer + w.it = internalTarget{ - client: c.client, - prm: prm, + client: cl, + prm: prm, + address: c.address(), + logger: &c.clientStatusMonitor, } key := &c.prm.key if prm.key != nil { @@ -35,9 +44,9 @@ func (c *clientWrapper) objectPutInitTransformer(prm PrmObjectPutClientCutInit) w.ot = transformer.NewPayloadSizeLimiter(transformer.Params{ Key: key, NextTargetInit: func() transformer.ObjectWriter { return &w.it }, - MaxSize: prm.maxSize, + MaxSize: prm.networkInfo.MaxObjectSize(), WithoutHomomorphicHash: prm.withoutHomomorphicHash, - NetworkState: prm.epochSource, + NetworkState: prm.networkInfo, SessionToken: prm.stoken, }) return &w, nil @@ -78,20 +87,41 @@ func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, err } type internalTarget struct { - client *sdkClient.Client - res ResObjectPut - prm PrmObjectPutClientCutInit - useStream bool + client *sdkClient.Client + res ResObjectPut + prm PrmObjectPutClientCutInit + useStream bool + address string + logger logger + resolveFrostFSErrors bool } func (it *internalTarget) WriteObject(ctx context.Context, o *object.Object) error { - // todo support PutSingle + putSingleImplemented, err := it.tryPutSingle(ctx, o) + if putSingleImplemented { + return err + } + + it.logger.log(zapcore.DebugLevel, "putSingle not implemented, trying put as stream", zap.String("address", it.address)) + it.useStream = true return it.putAsStream(ctx, o) } func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) error { - wrt, err := it.client.ObjectPutInit(ctx, it.prm.PrmObjectPutInit) + var cliPrm sdkClient.PrmObjectPutInit + cliPrm.SetCopiesNumberByVectors(it.prm.copiesNumber) + if it.prm.stoken != nil { + cliPrm.WithinSession(*it.prm.stoken) + } + if it.prm.key != nil { + cliPrm.UseKey(*it.prm.key) + } + if it.prm.btoken != nil { + cliPrm.WithBearerToken(*it.prm.btoken) + } + + wrt, err := it.client.ObjectPutInit(ctx, cliPrm) if err != nil { return err } @@ -105,3 +135,37 @@ func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) err } return err } + +func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (bool, error) { + if it.useStream { + return false, nil + } + var cliPrm sdkClient.PrmObjectPutSingle + cliPrm.SetCopiesNumber(it.prm.copiesNumber) + cliPrm.UseKey(it.prm.key) + if it.prm.stoken != nil { + cliPrm.WithinSession(*it.prm.stoken) + } + if it.prm.btoken != nil { + cliPrm.WithBearerToken(*it.prm.btoken) + } + cliPrm.SetObject(o.ToV2()) + + res, err := it.client.ObjectPutSingle(ctx, cliPrm) + if err != nil && status.Code(err) == codes.Unimplemented { + return false, err + } + + if err == nil { + id, _ := o.ID() + it.res = ResObjectPut{ + Status: res.Status(), + OID: id, + } + if !it.resolveFrostFSErrors && !apistatus.IsSuccessful(it.res.Status) { + return true, apistatus.ErrFromStatus(it.res.Status) + } + return true, nil + } + return true, err +} diff --git a/pool/pool.go b/pool/pool.go index a3f3b45..94c0813 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -252,6 +252,11 @@ func (x *wrapperPrm) setKey(key ecdsa.PrivateKey) { x.key = key } +// setLogger sets sdkClient.Client logger. +func (x *wrapperPrm) setLogger(logger *zap.Logger) { + x.logger = logger +} + // setDialTimeout sets the timeout for connection to be established. func (x *wrapperPrm) setDialTimeout(timeout time.Duration) { x.dialTimeout = timeout @@ -719,24 +724,8 @@ func (c *clientWrapper) objectPutServerCut(ctx context.Context, prm PrmObjectPut } func (c *clientWrapper) objectPutClientCut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { - var cliPrm sdkClient.PrmObjectPutInit - cliPrm.SetCopiesNumberByVectors(prm.copiesNumber) - if prm.stoken != nil { - cliPrm.WithinSession(*prm.stoken) - } - if prm.key != nil { - cliPrm.UseKey(*prm.key) - } - if prm.btoken != nil { - cliPrm.WithBearerToken(*prm.btoken) - } - putInitPrm := PrmObjectPutClientCutInit{ - PrmObjectPutInit: cliPrm, - key: prm.key, - maxSize: prm.networkInfo.MaxObjectSize(), - epochSource: prm.networkInfo, - stoken: prm.stoken, + PrmObjectPut: prm, } start := time.Now() @@ -1054,12 +1043,20 @@ func (c *clientStatusMonitor) incErrorRate() { } c.mu.Unlock() - if thresholdReached && c.logger != nil { - c.logger.Warn("error threshold reached", + if thresholdReached { + c.log(zapcore.WarnLevel, "error threshold reached", zap.String("address", c.addr), zap.Uint32("threshold", c.errorThreshold)) } } +func (c *clientStatusMonitor) log(level zapcore.Level, msg string, fields ...zap.Field) { + if c.logger == nil { + return + } + + c.logger.Log(level, msg, fields...) +} + func (c *clientStatusMonitor) currentErrorRate() uint32 { c.mu.RLock() defer c.mu.RUnlock() @@ -1911,6 +1908,7 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { var prm wrapperPrm prm.setAddress(addr) prm.setKey(*params.key) + prm.setLogger(params.logger) prm.setDialTimeout(params.nodeDialTimeout) prm.setStreamTimeout(params.nodeStreamTimeout) prm.setErrorThreshold(params.errorThreshold) From 202412230a05d2f91acabdb59cc9f934ded6d2bb Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 1 Aug 2023 12:52:18 +0300 Subject: [PATCH 081/323] [#115] pool: Drop part buffer pool Tests showed that using part buffer pool doesn't save memory a lot. Especially on big parts. Probably we can use pool only for small parts after adding buffer in payloadSizeLimiter Signed-off-by: Denis Kirillov --- ...rmer.go => object_put_pool_transformer.go} | 2 + pool/parts_buffer_pool.go | 69 ------------------- pool/pool.go | 62 +++++------------ 3 files changed, 20 insertions(+), 113 deletions(-) rename pool/{object_put_transformer.go => object_put_pool_transformer.go} (97%) delete mode 100644 pool/parts_buffer_pool.go diff --git a/pool/object_put_transformer.go b/pool/object_put_pool_transformer.go similarity index 97% rename from pool/object_put_transformer.go rename to pool/object_put_pool_transformer.go index 08d41dd..c6add15 100644 --- a/pool/object_put_transformer.go +++ b/pool/object_put_pool_transformer.go @@ -36,6 +36,7 @@ func (c *clientWrapper) objectPutInitTransformer(prm PrmObjectPutClientCutInit) address: c.address(), logger: &c.clientStatusMonitor, } + key := &c.prm.key if prm.key != nil { key = prm.key @@ -74,6 +75,7 @@ type ResObjectPut struct { OID oid.ID } +// Close return non nil result in any case. If error occurred, the result contains only buffer for further reusing. func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, error) { ai, err := x.ot.Close(ctx) if err != nil { diff --git a/pool/parts_buffer_pool.go b/pool/parts_buffer_pool.go deleted file mode 100644 index 828d859..0000000 --- a/pool/parts_buffer_pool.go +++ /dev/null @@ -1,69 +0,0 @@ -package pool - -import ( - "fmt" - "sync" -) - -type PartBuffer struct { - Buffer []byte - len uint64 -} - -type PartsBufferPool struct { - syncPool *sync.Pool - limit uint64 - maxObjectSize uint64 - - mu sync.Mutex - available uint64 -} - -func NewPartBufferPool(limit uint64, maxObjectSize uint64) *PartsBufferPool { - return &PartsBufferPool{ - limit: limit, - maxObjectSize: maxObjectSize, - available: limit, - syncPool: &sync.Pool{New: func() any { - // We have to use pointer (even for slices), see https://staticcheck.dev/docs/checks/#SA6002 - // It's based on interfaces implementation in 2016, so maybe something has changed since then. - // We can use no pointer for multi-kilobyte slices though https://github.com/golang/go/issues/16323#issuecomment-254401036 - buff := make([]byte, maxObjectSize) - return &buff - }}, - } -} - -func (p *PartsBufferPool) ParBufferSize() uint64 { - return p.maxObjectSize -} - -func (p *PartsBufferPool) GetBuffer() (*PartBuffer, error) { - p.mu.Lock() - defer p.mu.Unlock() - - if p.maxObjectSize > p.available { - return nil, fmt.Errorf("requested buffer size %d is greater than available: %d", p.maxObjectSize, p.available) - } - - p.available -= p.maxObjectSize - - return &PartBuffer{ - Buffer: *p.syncPool.Get().(*[]byte), - len: p.maxObjectSize, - }, nil -} - -func (p *PartsBufferPool) FreeBuffer(buff *PartBuffer) error { - p.mu.Lock() - defer p.mu.Unlock() - - if buff.len+p.available > p.limit { - return fmt.Errorf("buffer size %d to free is too large, available: %d, limit: %d", buff.len, p.available, p.limit) - } - - p.available += buff.len - p.syncPool.Put(&buff.Buffer) - - return nil -} diff --git a/pool/pool.go b/pool/pool.go index 94c0813..70f789e 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -679,7 +679,7 @@ func (c *clientWrapper) objectPutServerCut(ctx context.Context, prm PrmObjectPut } if prm.payload != nil { - const defaultBufferSizePut = 3 << 20 // configure? + const defaultBufferSizePut = 3 << 20 // default grpc message size, configure? if sz == 0 || sz > defaultBufferSizePut { sz = defaultBufferSizePut @@ -736,22 +736,33 @@ func (c *clientWrapper) objectPutClientCut(ctx context.Context, prm PrmObjectPut } if wObj.WriteHeader(ctx, prm.hdr) { + sz := prm.hdr.PayloadSize() + if data := prm.hdr.Payload(); len(data) > 0 { if prm.payload != nil { prm.payload = io.MultiReader(bytes.NewReader(data), prm.payload) } else { prm.payload = bytes.NewReader(data) + sz = uint64(len(data)) } } if prm.payload != nil { + const defaultBufferSizePut = 64 * 1024 // it's buffer size in s3-gw, configure? + + if sz == 0 || sz > defaultBufferSizePut { + sz = defaultBufferSizePut + } + + buf := make([]byte, sz) + var n int for { - n, err = prm.payload.Read(prm.partBuffer) + n, err = prm.payload.Read(buf) if n > 0 { start = time.Now() - successWrite := wObj.WritePayloadChunk(ctx, prm.partBuffer[:n]) + successWrite := wObj.WritePayloadChunk(ctx, buf[:n]) c.incRequests(time.Since(start), methodObjectPut) if !successWrite { break @@ -1151,7 +1162,6 @@ type InitParameters struct { nodeParams []NodeParam requestCallback func(RequestInfo) dialOptions []grpc.DialOption - maxClientCutMemory uint64 clientBuilder clientBuilder } @@ -1216,14 +1226,6 @@ func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption) { x.dialOptions = opts } -// SetMaxClientCutMemory sets the max amount of bytes that can be used during client cut (see PrmObjectPut.SetClientCut). -// Default value is 1gb (that should be enough for 200 concurrent PUT request for MaxObjectSize 50mb). -// If the MaxObjectSize network param is greater than limit is set by this method -// Pool.PutObject operations with PrmObjectPut.SetClientCut will fail. -func (x *InitParameters) SetMaxClientCutMemory(size uint64) { - x.maxClientCutMemory = size -} - // setClientBuilder sets clientBuilder used for client construction. // Wraps setClientBuilderContext without a context. func (x *InitParameters) setClientBuilder(builder clientBuilder) { @@ -1406,7 +1408,6 @@ type PrmObjectPut struct { copiesNumber []uint32 clientCut bool - partBuffer []byte networkInfo netmap.NetworkInfo } @@ -1442,10 +1443,6 @@ func (x *PrmObjectPut) SetClientCut(clientCut bool) { x.clientCut = clientCut } -func (x *PrmObjectPut) setPartBuffer(partBuffer []byte) { - x.partBuffer = partBuffer -} - func (x *PrmObjectPut) setNetworkInfo(ni netmap.NetworkInfo) { x.networkInfo = ni } @@ -1746,10 +1743,7 @@ type Pool struct { clientBuilder clientBuilder logger *zap.Logger - // we cannot initialize partBufferPool in NewPool function, - // so we have to save maxClientCutMemory param for further initialization in Dial. - maxClientCutMemory uint64 - partsBufferPool *PartsBufferPool + maxObjectSize uint64 } type innerPool struct { @@ -1761,7 +1755,6 @@ type innerPool struct { const ( defaultSessionTokenExpirationDuration = 100 // in blocks defaultErrorThreshold = 100 - defaultMaxClientCutMemory = 1024 * 1024 * 1024 // 1gb defaultRebalanceInterval = 15 * time.Second defaultHealthcheckTimeout = 4 * time.Second @@ -1798,8 +1791,7 @@ func NewPool(options InitParameters) (*Pool, error) { clientRebalanceInterval: options.clientRebalanceInterval, sessionExpirationDuration: options.sessionExpirationDuration, }, - clientBuilder: options.clientBuilder, - maxClientCutMemory: options.maxClientCutMemory, + clientBuilder: options.clientBuilder, } return pool, nil @@ -1860,7 +1852,7 @@ func (p *Pool) Dial(ctx context.Context) error { if err != nil { return fmt.Errorf("get network info for max object size: %w", err) } - p.partsBufferPool = NewPartBufferPool(p.maxClientCutMemory, ni.MaxObjectSize()) + p.maxObjectSize = ni.MaxObjectSize() go p.startRebalance(ctx) return nil @@ -1883,10 +1875,6 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { params.errorThreshold = defaultErrorThreshold } - if params.maxClientCutMemory == 0 { - params.maxClientCutMemory = defaultMaxClientCutMemory - } - if params.clientRebalanceInterval <= 0 { params.clientRebalanceInterval = defaultRebalanceInterval } @@ -2284,24 +2272,10 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) } if prm.clientCut { - buff, err := p.partsBufferPool.GetBuffer() - if err != nil { - return oid.ID{}, fmt.Errorf("cannot get buffer for put operations: %w", err) - } - - prm.setPartBuffer(buff.Buffer) - var ni netmap.NetworkInfo ni.SetCurrentEpoch(p.cache.Epoch()) - ni.SetMaxObjectSize(p.partsBufferPool.ParBufferSize()) // we want to use initial max object size in PayloadSizeLimiter - + ni.SetMaxObjectSize(p.maxObjectSize) // we want to use initial max object size in PayloadSizeLimiter prm.setNetworkInfo(ni) - - defer func() { - if errFree := p.partsBufferPool.FreeBuffer(buff); errFree != nil { - p.log(zap.WarnLevel, "failed to free part buffer", zap.Error(err)) - } - }() } id, err := ctxCall.client.objectPut(ctx, prm) From 46a214d065f872f31f68cd147619490ea3d9fd9a Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 25 Aug 2023 09:36:08 +0300 Subject: [PATCH 082/323] [#149] pool: Configure homomorphic hash and buffer size Signed-off-by: Denis Kirillov --- pool/object_put_pool_transformer.go | 1 - pool/pool.go | 34 ++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/pool/object_put_pool_transformer.go b/pool/object_put_pool_transformer.go index c6add15..52c6813 100644 --- a/pool/object_put_pool_transformer.go +++ b/pool/object_put_pool_transformer.go @@ -20,7 +20,6 @@ type logger interface { type PrmObjectPutClientCutInit struct { PrmObjectPut - withoutHomomorphicHash bool } func (c *clientWrapper) objectPutInitTransformer(prm PrmObjectPutClientCutInit) (*objectWriterTransformer, error) { diff --git a/pool/pool.go b/pool/pool.go index 70f789e..4f8a42a 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -634,6 +634,10 @@ func (c *clientWrapper) networkInfo(ctx context.Context, _ prmNetworkInfo) (netm // objectPut writes object to FrostFS. func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { + if prm.bufferMaxSize == 0 { + prm.bufferMaxSize = defaultBufferMaxSizeForPut + } + if prm.clientCut { return c.objectPutClientCut(ctx, prm) } @@ -679,10 +683,8 @@ func (c *clientWrapper) objectPutServerCut(ctx context.Context, prm PrmObjectPut } if prm.payload != nil { - const defaultBufferSizePut = 3 << 20 // default grpc message size, configure? - - if sz == 0 || sz > defaultBufferSizePut { - sz = defaultBufferSizePut + if sz == 0 || sz > prm.bufferMaxSize { + sz = prm.bufferMaxSize } buf := make([]byte, sz) @@ -748,10 +750,8 @@ func (c *clientWrapper) objectPutClientCut(ctx context.Context, prm PrmObjectPut } if prm.payload != nil { - const defaultBufferSizePut = 64 * 1024 // it's buffer size in s3-gw, configure? - - if sz == 0 || sz > defaultBufferSizePut { - sz = defaultBufferSizePut + if sz == 0 || sz > prm.bufferMaxSize { + sz = prm.bufferMaxSize } buf := make([]byte, sz) @@ -1409,6 +1409,10 @@ type PrmObjectPut struct { clientCut bool networkInfo netmap.NetworkInfo + + withoutHomomorphicHash bool + + bufferMaxSize uint64 } // SetHeader specifies header of the object. @@ -1443,6 +1447,18 @@ func (x *PrmObjectPut) SetClientCut(clientCut bool) { x.clientCut = clientCut } +// WithoutHomomorphicHash if set to true do not use Tillich-Zémor hash for payload. +func (x *PrmObjectPut) WithoutHomomorphicHash(v bool) { + x.withoutHomomorphicHash = v +} + +// SetBufferMaxSize sets max buffer size to read payload. +// This value isn't used if object size is set explicitly and less than this value. +// Default value 3MB. +func (x *PrmObjectPut) SetBufferMaxSize(size uint64) { + x.bufferMaxSize = size +} + func (x *PrmObjectPut) setNetworkInfo(ni netmap.NetworkInfo) { x.networkInfo = ni } @@ -1760,6 +1776,8 @@ const ( defaultHealthcheckTimeout = 4 * time.Second defaultDialTimeout = 5 * time.Second defaultStreamTimeout = 10 * time.Second + + defaultBufferMaxSizeForPut = 3 * 1024 * 1024 // 3 MB ) // NewPool creates connection pool using parameters. From 84e7e69f98ac8c0d6ef09fb90bb60ba035aade17 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 28 Aug 2023 11:07:18 +0300 Subject: [PATCH 083/323] [#121] client: Make PrmObjectGet/Head/GetRange fields public * Remove common PrmObjectRead structure * Introduce buildRequest for PrmObjectGet/Head/GetRange * Refactor the usage of these params in pool Signed-off-by: Airat Arifullin --- client/common.go | 2 + client/object_get.go | 397 ++++++++++++++++++++++++++----------------- pool/pool.go | 71 +++----- 3 files changed, 272 insertions(+), 198 deletions(-) diff --git a/client/common.go b/client/common.go index 907f6be..3895b00 100644 --- a/client/common.go +++ b/client/common.go @@ -47,6 +47,8 @@ func writeXHeadersToMeta(xHeaders []string, h *v2session.RequestMetaHeader) { return } + // TODO (aarifullin): remove the panic when all client parameters will check XHeaders + // within buildRequest invocation. if len(xHeaders)%2 != 0 { panic("slice of X-Headers with odd length") } diff --git a/client/object_get.go b/client/object_get.go index 02de74a..56cbfda 100644 --- a/client/object_get.go +++ b/client/object_get.go @@ -22,77 +22,76 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" ) -// shared parameters of GET/HEAD/RANGE. -type prmObjectRead struct { - meta v2session.RequestMetaHeader - - raw bool - - addr v2refs.Address -} - -// WithXHeaders specifies list of extended headers (string key-value pairs) -// to be attached to the request. Must have an even length. -// -// Slice must not be mutated until the operation completes. -func (x *prmObjectRead) WithXHeaders(hs ...string) { - writeXHeadersToMeta(hs, &x.meta) -} - -// MarkRaw marks an intent to read physically stored object. -func (x *prmObjectRead) MarkRaw() { - x.raw = true -} - -// MarkLocal tells the server to execute the operation locally. -func (x *prmObjectRead) MarkLocal() { - x.meta.SetTTL(1) -} - -// WithinSession specifies session within which object should be read. -// -// Creator of the session acquires the authorship of the request. -// This may affect the execution of an operation (e.g. access control). -// -// Must be signed. -func (x *prmObjectRead) WithinSession(t session.Object) { - var tokv2 v2session.Token - t.WriteToV2(&tokv2) - x.meta.SetSessionToken(&tokv2) -} - -// WithBearerToken attaches bearer token to be used for the operation. -// -// If set, underlying eACL rules will be used in access control. -// -// Must be signed. -func (x *prmObjectRead) WithBearerToken(t bearer.Token) { - var v2token acl.BearerToken - t.WriteToV2(&v2token) - x.meta.SetBearerToken(&v2token) -} - -// FromContainer specifies FrostFS container of the object. -// Required parameter. -func (x *prmObjectRead) FromContainer(id cid.ID) { - var cnrV2 v2refs.ContainerID - id.WriteToV2(&cnrV2) - x.addr.SetContainerID(&cnrV2) -} - -// ByID specifies identifier of the requested object. -// Required parameter. -func (x *prmObjectRead) ByID(id oid.ID) { - var objV2 v2refs.ObjectID - id.WriteToV2(&objV2) - x.addr.SetObjectID(&objV2) -} - // PrmObjectGet groups parameters of ObjectGetInit operation. type PrmObjectGet struct { - prmObjectRead + XHeaders []string - key *ecdsa.PrivateKey + BearerToken *bearer.Token + + Session *session.Object + + Raw bool + + Local bool + + ContainerID *cid.ID + + ObjectID *oid.ID + + Key *ecdsa.PrivateKey +} + +func (prm *PrmObjectGet) buildRequest(c *Client) (*v2object.GetRequest, error) { + if prm.ContainerID == nil { + return nil, errorMissingContainer + } + + if prm.ObjectID == nil { + return nil, errorMissingObject + } + + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + meta := new(v2session.RequestMetaHeader) + writeXHeadersToMeta(prm.XHeaders, meta) + + if prm.BearerToken != nil { + v2BearerToken := new(acl.BearerToken) + prm.BearerToken.WriteToV2(v2BearerToken) + meta.SetBearerToken(v2BearerToken) + } + + if prm.Session != nil { + v2SessionToken := new(v2session.Token) + prm.Session.WriteToV2(v2SessionToken) + meta.SetSessionToken(v2SessionToken) + } + + if prm.Local { + meta.SetTTL(1) + } + + addr := new(v2refs.Address) + + cnrV2 := new(v2refs.ContainerID) + prm.ContainerID.WriteToV2(cnrV2) + addr.SetContainerID(cnrV2) + + objV2 := new(v2refs.ObjectID) + prm.ObjectID.WriteToV2(objV2) + addr.SetObjectID(objV2) + + body := new(v2object.GetRequestBody) + body.SetRaw(prm.Raw) + body.SetAddress(addr) + + req := new(v2object.GetRequest) + req.SetBody(body) + c.prepareRequest(req, meta) + + return req, nil } // ResObjectGet groups the final result values of ObjectGetInit operation. @@ -122,8 +121,10 @@ type ObjectReader struct { // UseKey specifies private key to sign the requests. // If key is not provided, then Client default key is used. -func (x *PrmObjectGet) UseKey(key ecdsa.PrivateKey) { - x.key = &key +// +// Deprecated: Use PrmObjectGet.Key instead. +func (prm *PrmObjectGet) UseKey(key ecdsa.PrivateKey) { + prm.Key = &key } // ReadHeader reads header of the object. Result means success. @@ -299,39 +300,24 @@ func (x *ObjectReader) Read(p []byte) (int, error) { // Returns an error if parameters are set incorrectly (see PrmObjectGet docs). // Context is required and must not be nil. It is used for network communication. func (c *Client) ObjectGetInit(ctx context.Context, prm PrmObjectGet) (*ObjectReader, error) { - // check parameters - switch { - case prm.addr.GetContainerID() == nil: - return nil, errorMissingContainer - case prm.addr.GetObjectID() == nil: - return nil, errorMissingObject + req, err := prm.buildRequest(c) + if err != nil { + return nil, err } - // form request body - var body v2object.GetRequestBody - - body.SetRaw(prm.raw) - body.SetAddress(&prm.addr) - - // form request - var req v2object.GetRequest - - req.SetBody(&body) - c.prepareRequest(&req, &prm.meta) - - key := prm.key + key := prm.Key if key == nil { key = &c.prm.key } - err := signature.SignServiceMessage(key, &req) + err = signature.SignServiceMessage(key, req) if err != nil { return nil, fmt.Errorf("sign request: %w", err) } ctx, cancel := context.WithCancel(ctx) - stream, err := rpcapi.GetObject(&c.c, &req, client.WithContext(ctx)) + stream, err := rpcapi.GetObject(&c.c, req, client.WithContext(ctx)) if err != nil { cancel() return nil, fmt.Errorf("open stream: %w", err) @@ -347,17 +333,29 @@ func (c *Client) ObjectGetInit(ctx context.Context, prm PrmObjectGet) (*ObjectRe // PrmObjectHead groups parameters of ObjectHead operation. type PrmObjectHead struct { - prmObjectRead + XHeaders []string - keySet bool - key ecdsa.PrivateKey + BearerToken *bearer.Token + + Session *session.Object + + Raw bool + + Local bool + + ContainerID *cid.ID + + ObjectID *oid.ID + + Key *ecdsa.PrivateKey } // UseKey specifies private key to sign the requests. // If key is not provided, then Client default key is used. -func (x *PrmObjectHead) UseKey(key ecdsa.PrivateKey) { - x.keySet = true - x.key = key +// +// Deprecated: Use PrmObjectHead.Key instead. +func (prm *PrmObjectHead) UseKey(key ecdsa.PrivateKey) { + prm.Key = &key } // ResObjectHead groups resulting values of ObjectHead operation. @@ -390,6 +388,58 @@ func (x *ResObjectHead) ReadHeader(dst *object.Object) bool { return true } +func (prm *PrmObjectHead) buildRequest(c *Client) (*v2object.HeadRequest, error) { + if prm.ContainerID == nil { + return nil, errorMissingContainer + } + + if prm.ObjectID == nil { + return nil, errorMissingObject + } + + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + meta := new(v2session.RequestMetaHeader) + writeXHeadersToMeta(prm.XHeaders, meta) + + if prm.BearerToken != nil { + v2BearerToken := new(acl.BearerToken) + prm.BearerToken.WriteToV2(v2BearerToken) + meta.SetBearerToken(v2BearerToken) + } + + if prm.Session != nil { + v2SessionToken := new(v2session.Token) + prm.Session.WriteToV2(v2SessionToken) + meta.SetSessionToken(v2SessionToken) + } + + if prm.Local { + meta.SetTTL(1) + } + + addr := new(v2refs.Address) + + cnrV2 := new(v2refs.ContainerID) + prm.ContainerID.WriteToV2(cnrV2) + addr.SetContainerID(cnrV2) + + objV2 := new(v2refs.ObjectID) + prm.ObjectID.WriteToV2(objV2) + addr.SetObjectID(objV2) + body := new(v2object.HeadRequestBody) + body.SetRaw(prm.Raw) + body.SetAddress(addr) + + req := new(v2object.HeadRequest) + req.SetBody(body) + c.prepareRequest(req, meta) + + return req, nil +} + // ObjectHead reads object header through a remote server using FrostFS API protocol. // // Exactly one return value is non-nil. By default, server status is returned in res structure. @@ -413,33 +463,24 @@ func (x *ResObjectHead) ReadHeader(dst *object.Object) bool { // - *apistatus.ObjectAlreadyRemoved; // - *apistatus.SessionTokenExpired. func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectHead, error) { - switch { - case prm.addr.GetContainerID() == nil: - return nil, errorMissingContainer - case prm.addr.GetObjectID() == nil: - return nil, errorMissingObject + req, err := prm.buildRequest(c) + if err != nil { + return nil, err } - var body v2object.HeadRequestBody - body.SetRaw(prm.raw) - body.SetAddress(&prm.addr) - - var req v2object.HeadRequest - req.SetBody(&body) - c.prepareRequest(&req, &prm.meta) - key := c.prm.key - if prm.keySet { - key = prm.key + if prm.Key != nil { + key = *prm.Key } // sign the request - err := signature.SignServiceMessage(&key, &req) + + err = signature.SignServiceMessage(&key, req) if err != nil { return nil, fmt.Errorf("sign request: %w", err) } - resp, err := rpcapi.HeadObject(&c.c, &req, client.WithContext(ctx)) + resp, err := rpcapi.HeadObject(&c.c, req, client.WithContext(ctx)) if err != nil { return nil, fmt.Errorf("write request: %w", err) } @@ -454,7 +495,7 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH return &res, nil } - _ = res.idObj.ReadFromV2(*prm.addr.GetObjectID()) + res.idObj = *prm.ObjectID switch v := resp.GetBody().GetHeaderPart().(type) { default: @@ -470,29 +511,95 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH // PrmObjectRange groups parameters of ObjectRange operation. type PrmObjectRange struct { - prmObjectRead + XHeaders []string - key *ecdsa.PrivateKey + BearerToken *bearer.Token - rng v2object.Range + Session *session.Object + + Raw bool + + Local bool + + ContainerID *cid.ID + + ObjectID *oid.ID + + Key *ecdsa.PrivateKey + + Offset uint64 + + Length uint64 } -// SetOffset sets offset of the payload range to be read. -// Zero by default. -func (x *PrmObjectRange) SetOffset(off uint64) { - x.rng.SetOffset(off) -} +func (prm *PrmObjectRange) buildRequest(c *Client) (*v2object.GetRangeRequest, error) { + if prm.Length == 0 { + return nil, errorZeroRangeLength + } -// SetLength sets length of the payload range to be read. -// Must be positive. -func (x *PrmObjectRange) SetLength(ln uint64) { - x.rng.SetLength(ln) + if prm.ContainerID == nil { + return nil, errorMissingContainer + } + + if prm.ObjectID == nil { + return nil, errorMissingObject + } + + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + meta := new(v2session.RequestMetaHeader) + writeXHeadersToMeta(prm.XHeaders, meta) + + if prm.BearerToken != nil { + v2BearerToken := new(acl.BearerToken) + prm.BearerToken.WriteToV2(v2BearerToken) + meta.SetBearerToken(v2BearerToken) + } + + if prm.Session != nil { + v2SessionToken := new(v2session.Token) + prm.Session.WriteToV2(v2SessionToken) + meta.SetSessionToken(v2SessionToken) + } + + if prm.Local { + meta.SetTTL(1) + } + + addr := new(v2refs.Address) + + cnrV2 := new(v2refs.ContainerID) + prm.ContainerID.WriteToV2(cnrV2) + addr.SetContainerID(cnrV2) + + objV2 := new(v2refs.ObjectID) + prm.ObjectID.WriteToV2(objV2) + addr.SetObjectID(objV2) + + rng := new(v2object.Range) + rng.SetLength(prm.Length) + rng.SetOffset(prm.Offset) + + body := new(v2object.GetRangeRequestBody) + body.SetRaw(prm.Raw) + body.SetAddress(addr) + body.SetRange(rng) + + req := new(v2object.GetRangeRequest) + req.SetBody(body) + c.prepareRequest(req, meta) + + return req, nil } // UseKey specifies private key to sign the requests. // If key is not provided, then Client default key is used. -func (x *PrmObjectRange) UseKey(key ecdsa.PrivateKey) { - x.key = &key +// +// Deprecated: Use PrmObjectRange.Key instead. +func (prm *PrmObjectRange) UseKey(key ecdsa.PrivateKey) { + prm.Key = &key } // ResObjectRange groups the final result values of ObjectRange operation. @@ -662,49 +769,31 @@ func (x *ObjectRangeReader) Read(p []byte) (int, error) { // Returns an error if parameters are set incorrectly (see PrmObjectRange docs). // Context is required and must not be nil. It is used for network communication. func (c *Client) ObjectRangeInit(ctx context.Context, prm PrmObjectRange) (*ObjectRangeReader, error) { - // check parameters - switch { - case prm.addr.GetContainerID() == nil: - return nil, errorMissingContainer - case prm.addr.GetObjectID() == nil: - return nil, errorMissingObject - case prm.rng.GetLength() == 0: - return nil, errorZeroRangeLength + req, err := prm.buildRequest(c) + if err != nil { + return nil, err } - // form request body - var body v2object.GetRangeRequestBody - - body.SetRaw(prm.raw) - body.SetAddress(&prm.addr) - body.SetRange(&prm.rng) - - // form request - var req v2object.GetRangeRequest - - req.SetBody(&body) - c.prepareRequest(&req, &prm.meta) - - key := prm.key + key := prm.Key if key == nil { key = &c.prm.key } - err := signature.SignServiceMessage(key, &req) + err = signature.SignServiceMessage(key, req) if err != nil { return nil, fmt.Errorf("sign request: %w", err) } ctx, cancel := context.WithCancel(ctx) - stream, err := rpcapi.GetObjectRange(&c.c, &req, client.WithContext(ctx)) + stream, err := rpcapi.GetObjectRange(&c.c, req, client.WithContext(ctx)) if err != nil { cancel() return nil, fmt.Errorf("open stream: %w", err) } var r ObjectRangeReader - r.remainingPayloadLen = int(prm.rng.GetLength()) + r.remainingPayloadLen = int(prm.Length) r.cancelCtxStream = cancel r.stream = stream r.client = c diff --git a/pool/pool.go b/pool/pool.go index 4f8a42a..b4cc887 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -835,20 +835,15 @@ func (c *clientWrapper) objectGet(ctx context.Context, prm PrmObjectGet) (ResGet return ResGetObject{}, err } - var cliPrm sdkClient.PrmObjectGet - cliPrm.FromContainer(prm.addr.Container()) - cliPrm.ByID(prm.addr.Object()) + prmCnr := prm.addr.Container() + prmObj := prm.addr.Object() - if prm.stoken != nil { - cliPrm.WithinSession(*prm.stoken) - } - - if prm.btoken != nil { - cliPrm.WithBearerToken(*prm.btoken) - } - - if prm.key != nil { - cliPrm.UseKey(*prm.key) + cliPrm := sdkClient.PrmObjectGet{ + BearerToken: prm.btoken, + Session: prm.stoken, + ContainerID: &prmCnr, + ObjectID: &prmObj, + Key: prm.key, } var res ResGetObject @@ -888,23 +883,16 @@ func (c *clientWrapper) objectHead(ctx context.Context, prm PrmObjectHead) (obje return object.Object{}, err } - var cliPrm sdkClient.PrmObjectHead - cliPrm.FromContainer(prm.addr.Container()) - cliPrm.ByID(prm.addr.Object()) - if prm.raw { - cliPrm.MarkRaw() - } + prmCnr := prm.addr.Container() + prmObj := prm.addr.Object() - if prm.stoken != nil { - cliPrm.WithinSession(*prm.stoken) - } - - if prm.btoken != nil { - cliPrm.WithBearerToken(*prm.btoken) - } - - if prm.key != nil { - cliPrm.UseKey(*prm.key) + cliPrm := sdkClient.PrmObjectHead{ + BearerToken: prm.btoken, + Session: prm.stoken, + Raw: prm.raw, + ContainerID: &prmCnr, + ObjectID: &prmObj, + Key: prm.key, } var obj object.Object @@ -933,22 +921,17 @@ func (c *clientWrapper) objectRange(ctx context.Context, prm PrmObjectRange) (Re return ResObjectRange{}, err } - var cliPrm sdkClient.PrmObjectRange - cliPrm.FromContainer(prm.addr.Container()) - cliPrm.ByID(prm.addr.Object()) - cliPrm.SetOffset(prm.off) - cliPrm.SetLength(prm.ln) + prmCnr := prm.addr.Container() + prmObj := prm.addr.Object() - if prm.stoken != nil { - cliPrm.WithinSession(*prm.stoken) - } - - if prm.btoken != nil { - cliPrm.WithBearerToken(*prm.btoken) - } - - if prm.key != nil { - cliPrm.UseKey(*prm.key) + cliPrm := sdkClient.PrmObjectRange{ + BearerToken: prm.btoken, + Session: prm.stoken, + ContainerID: &prmCnr, + ObjectID: &prmObj, + Offset: prm.off, + Length: prm.ln, + Key: prm.key, } start := time.Now() From b5fe52d6bd2dccae43dc6cdd5d2e0d998e3dd9fb Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 29 Aug 2023 08:41:59 +0300 Subject: [PATCH 084/323] [#150] policy: Check for redundant selectors and filters Signed-off-by: Anton Nikiforov --- netmap/policy.go | 59 ++++++++++++++++++++++++++-------- netmap/policy_decode_test.go | 61 ++++++++++++++++++++++++++++++++++++ netmap/policy_test.go | 50 ----------------------------- 3 files changed, 107 insertions(+), 63 deletions(-) create mode 100644 netmap/policy_decode_test.go diff --git a/netmap/policy.go b/netmap/policy.go index d706556..df84a8f 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -551,7 +551,7 @@ func (p *PlacementPolicy) DecodeString(s string) error { return errors.New("parsed nil value") } - if err := validatePolicy(*p); err != nil { + if err := validatePolicy(*parsed); err != nil { return fmt.Errorf("invalid policy: %w", err) } @@ -605,6 +605,13 @@ var ( errUnknownSelector = errors.New("policy: selector not found") // errSyntaxError is returned for errors found by ANTLR parser. errSyntaxError = errors.New("policy: syntax error") + // errRedundantSelector is returned for errors found by selectors policy validator. + errRedundantSelector = errors.New("policy: found redundant selector") + // errUnnamedSelector is returned for errors found by selectors policy validator. + errUnnamedSelector = errors.New("policy: unnamed selectors are useless, " + + "make sure to pair REP and SELECT clauses: \"REP .. IN X\" + \"SELECT ... AS X\"") + // errRedundantSelector is returned for errors found by filters policy validator. + errRedundantFilter = errors.New("policy: found redundant filter") ) type policyVisitor struct { @@ -846,24 +853,50 @@ func (p *policyVisitor) VisitExpr(ctx *parser.ExprContext) any { // being actually defined in FILTER section. func validatePolicy(p PlacementPolicy) error { seenFilters := map[string]bool{} - + expectedFilters := map[string]struct{}{} for i := range p.filters { seenFilters[p.filters[i].GetName()] = true - } - - seenSelectors := map[string]bool{} - - for i := range p.selectors { - if flt := p.selectors[i].GetFilter(); flt != mainFilterName && !seenFilters[flt] { - return fmt.Errorf("%w: '%s'", errUnknownFilter, flt) + for _, f := range p.filters[i].GetFilters() { + if f.GetName() != "" { + expectedFilters[f.GetName()] = struct{}{} + } } - - seenSelectors[p.selectors[i].GetName()] = true } + seenSelectors := map[string]*netmap.Selector{} + for i := range p.selectors { + if p.selectors[i].GetName() == "" { + return errUnnamedSelector + } + if flt := p.selectors[i].GetFilter(); flt != mainFilterName { + expectedFilters[flt] = struct{}{} + if !seenFilters[flt] { + return fmt.Errorf("%w: '%s'", errUnknownFilter, flt) + } + } + seenSelectors[p.selectors[i].GetName()] = &p.selectors[i] + } + + for _, f := range p.filters { + if _, ok := expectedFilters[f.GetName()]; !ok { + return fmt.Errorf("%w: '%s'", errRedundantFilter, f.GetName()) + } + } + + expectedSelectors := map[string]struct{}{} for i := range p.replicas { - if sel := p.replicas[i].GetSelector(); sel != "" && !seenSelectors[sel] { - return fmt.Errorf("%w: '%s'", errUnknownSelector, sel) + selName := p.replicas[i].GetSelector() + if selName != "" { + expectedSelectors[selName] = struct{}{} + if seenSelectors[selName] == nil { + return fmt.Errorf("%w: '%s'", errUnknownSelector, selName) + } + } + } + + for _, s := range p.selectors { + if _, ok := expectedSelectors[s.GetName()]; !ok { + return fmt.Errorf("%w: to use selector '%s' use keyword IN", errRedundantSelector, s.GetName()) } } diff --git a/netmap/policy_decode_test.go b/netmap/policy_decode_test.go new file mode 100644 index 0000000..d1e3cb6 --- /dev/null +++ b/netmap/policy_decode_test.go @@ -0,0 +1,61 @@ +package netmap + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDecodeString(t *testing.T) { + testCases := []string{ + `REP 1 IN X +CBF 1 +SELECT 2 IN SAME Location FROM * AS X`, + + `REP 1 IN X +REP 2 IN Y +CBF 1 +SELECT 2 FROM * AS X +SELECT 3 FROM * AS Y`, + + `REP 1 IN X +SELECT 2 IN City FROM Good AS X +FILTER Country EQ RU AS FromRU +FILTER Country EQ EN AS FromEN +FILTER @FromRU AND @FromEN AND Rating GT 7 AS Good`, + + `REP 7 IN SPB +SELECT 1 IN City FROM SPBSSD AS SPB +FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`, + + `REP 7 IN SPB +SELECT 1 IN City FROM SPBSSD AS SPB +FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS SPBSSD`, + + `UNIQUE +REP 1 +REP 1`, + } + + var p PlacementPolicy + + for _, testCase := range testCases { + require.NoError(t, p.DecodeString(testCase), "unable parse %s", testCase) + var b strings.Builder + require.NoError(t, p.WriteStringTo(&b)) + require.Equal(t, testCase, b.String()) + } + + invalidTestCases := map[string]error{ + `?REP 1`: errSyntaxError, + `REP 1 trailing garbage`: errSyntaxError, + `REP 1 SELECT 4 FROM * `: errUnnamedSelector, + `REP 1 SELECT 4 FROM * AS X`: errRedundantSelector, + `REP 1 IN X REP 2 SELECT 4 FROM * AS X FILTER 'UN-LOCODE' EQ 'RU LED' AS F`: errRedundantFilter, + } + + for i := range invalidTestCases { + require.ErrorIs(t, p.DecodeString(i), invalidTestCases[i], "#%s", i) + } +} diff --git a/netmap/policy_test.go b/netmap/policy_test.go index f954eec..05b0c98 100644 --- a/netmap/policy_test.go +++ b/netmap/policy_test.go @@ -1,7 +1,6 @@ package netmap_test import ( - "strings" "testing" . "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" @@ -9,55 +8,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestEncode(t *testing.T) { - testCases := []string{ - `REP 1 IN X -CBF 1 -SELECT 2 IN SAME Location FROM * AS X`, - - `REP 1 -SELECT 2 IN City FROM Good -FILTER Country EQ RU AS FromRU -FILTER @FromRU AND Rating GT 7 AS Good`, - - `REP 7 IN SPB -SELECT 1 IN City FROM SPBSSD AS SPB -FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`, - - `REP 7 IN SPB -SELECT 1 IN City FROM SPBSSD AS SPB -FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS SPBSSD`, - - `UNIQUE -REP 1 -REP 1`, - - `REP 1 IN X -SELECT 1 FROM F AS X -FILTER 'UN-LOCODE' EQ 'RU LED' AS F`, - } - - var p PlacementPolicy - - for _, testCase := range testCases { - require.NoError(t, p.DecodeString(testCase)) - - var b strings.Builder - require.NoError(t, p.WriteStringTo(&b)) - - require.Equal(t, testCase, b.String()) - } - - invalidTestCases := []string{ - `?REP 1`, - `REP 1 trailing garbage`, - } - - for i := range invalidTestCases { - require.Error(t, p.DecodeString(invalidTestCases[i]), "#%d", i) - } -} - func TestPlacementPolicyEncoding(t *testing.T) { v := netmaptest.PlacementPolicy() From 5a471e5002a77b8425215bcf8760b2a6f7ed1316 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 4 Sep 2023 13:23:10 +0300 Subject: [PATCH 085/323] [#121] client: Make PrmObjectDelete fields public * Introduce buildRequest for PrmObjectDelete * Refactor the usage of these params in pool Signed-off-by: Airat Arifullin --- client/object_delete.go | 136 +++++++++++++++++++--------------------- pool/pool.go | 21 +++---- 2 files changed, 72 insertions(+), 85 deletions(-) diff --git a/client/object_delete.go b/client/object_delete.go index 873cf3d..993cd5d 100644 --- a/client/object_delete.go +++ b/client/object_delete.go @@ -21,71 +21,25 @@ import ( // PrmObjectDelete groups parameters of ObjectDelete operation. type PrmObjectDelete struct { - meta v2session.RequestMetaHeader + XHeaders []string - body v2object.DeleteRequestBody + BearerToken *bearer.Token - addr v2refs.Address + Session *session.Object - keySet bool - key ecdsa.PrivateKey -} + ContainerID *cid.ID -// WithinSession specifies session within which object should be read. -// -// Creator of the session acquires the authorship of the request. -// This may affect the execution of an operation (e.g. access control). -// -// Must be signed. -func (x *PrmObjectDelete) WithinSession(t session.Object) { - var tv2 v2session.Token - t.WriteToV2(&tv2) + ObjectID *oid.ID - x.meta.SetSessionToken(&tv2) -} - -// WithBearerToken attaches bearer token to be used for the operation. -// -// If set, underlying eACL rules will be used in access control. -// -// Must be signed. -func (x *PrmObjectDelete) WithBearerToken(t bearer.Token) { - var v2token acl.BearerToken - t.WriteToV2(&v2token) - x.meta.SetBearerToken(&v2token) -} - -// FromContainer specifies FrostFS container of the object. -// Required parameter. -func (x *PrmObjectDelete) FromContainer(id cid.ID) { - var cidV2 v2refs.ContainerID - id.WriteToV2(&cidV2) - - x.addr.SetContainerID(&cidV2) -} - -// ByID specifies identifier of the requested object. -// Required parameter. -func (x *PrmObjectDelete) ByID(id oid.ID) { - var idV2 v2refs.ObjectID - id.WriteToV2(&idV2) - - x.addr.SetObjectID(&idV2) + Key *ecdsa.PrivateKey } // UseKey specifies private key to sign the requests. // If key is not provided, then Client default key is used. -func (x *PrmObjectDelete) UseKey(key ecdsa.PrivateKey) { - x.keySet = true - x.key = key -} - -// WithXHeaders specifies list of extended headers (string key-value pairs) -// to be attached to the request. Must have an even length. // -// Slice must not be mutated until the operation completes. -func (x *PrmObjectDelete) WithXHeaders(hs ...string) { - writeXHeadersToMeta(hs, &x.meta) +// Deprecated: Use PrmObjectDelete.Key instead. +func (prm *PrmObjectDelete) UseKey(key ecdsa.PrivateKey) { + prm.Key = &key } // ResObjectDelete groups resulting values of ObjectDelete operation. @@ -100,6 +54,54 @@ func (x ResObjectDelete) Tombstone() oid.ID { return x.tomb } +func (prm *PrmObjectDelete) buildRequest(c *Client) (*v2object.DeleteRequest, error) { + if prm.ContainerID == nil { + return nil, errorMissingContainer + } + + if prm.ObjectID == nil { + return nil, errorMissingObject + } + + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + meta := new(v2session.RequestMetaHeader) + writeXHeadersToMeta(prm.XHeaders, meta) + + if prm.BearerToken != nil { + v2BearerToken := new(acl.BearerToken) + prm.BearerToken.WriteToV2(v2BearerToken) + meta.SetBearerToken(v2BearerToken) + } + + if prm.Session != nil { + v2SessionToken := new(v2session.Token) + prm.Session.WriteToV2(v2SessionToken) + meta.SetSessionToken(v2SessionToken) + } + + addr := new(v2refs.Address) + + cnrV2 := new(v2refs.ContainerID) + prm.ContainerID.WriteToV2(cnrV2) + addr.SetContainerID(cnrV2) + + objV2 := new(v2refs.ObjectID) + prm.ObjectID.WriteToV2(objV2) + addr.SetObjectID(objV2) + + body := new(v2object.DeleteRequestBody) + body.SetAddress(addr) + + req := new(v2object.DeleteRequest) + req.SetBody(body) + c.prepareRequest(req, meta) + + return req, nil +} + // ObjectDelete marks an object for deletion from the container using FrostFS API protocol. // As a marker, a special unit called a tombstone is placed in the container. // It confirms the user's intent to delete the object, and is itself a container object. @@ -124,32 +126,22 @@ func (x ResObjectDelete) Tombstone() oid.ID { // - *apistatus.ObjectLocked; // - *apistatus.SessionTokenExpired. func (c *Client) ObjectDelete(ctx context.Context, prm PrmObjectDelete) (*ResObjectDelete, error) { - switch { - case prm.addr.GetContainerID() == nil: - return nil, errorMissingContainer - case prm.addr.GetObjectID() == nil: - return nil, errorMissingObject + req, err := prm.buildRequest(c) + if err != nil { + return nil, err } - // form request body - prm.body.SetAddress(&prm.addr) - - // form request - var req v2object.DeleteRequest - req.SetBody(&prm.body) - c.prepareRequest(&req, &prm.meta) - key := c.prm.key - if prm.keySet { - key = prm.key + if prm.Key != nil { + key = *prm.Key } - err := signature.SignServiceMessage(&key, &req) + err = signature.SignServiceMessage(&key, req) if err != nil { return nil, fmt.Errorf("sign request: %w", err) } - resp, err := rpcapi.DeleteObject(&c.c, &req, client.WithContext(ctx)) + resp, err := rpcapi.DeleteObject(&c.c, req, client.WithContext(ctx)) if err != nil { return nil, err } diff --git a/pool/pool.go b/pool/pool.go index b4cc887..6dc8fb9 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -799,20 +799,15 @@ func (c *clientWrapper) objectDelete(ctx context.Context, prm PrmObjectDelete) e return err } - var cliPrm sdkClient.PrmObjectDelete - cliPrm.FromContainer(prm.addr.Container()) - cliPrm.ByID(prm.addr.Object()) + cnr := prm.addr.Container() + obj := prm.addr.Object() - if prm.stoken != nil { - cliPrm.WithinSession(*prm.stoken) - } - - if prm.btoken != nil { - cliPrm.WithBearerToken(*prm.btoken) - } - - if prm.key != nil { - cliPrm.UseKey(*prm.key) + cliPrm := sdkClient.PrmObjectDelete{ + BearerToken: prm.btoken, + Session: prm.stoken, + ContainerID: &cnr, + ObjectID: &obj, + Key: prm.key, } start := time.Now() From 291a71ba84a0b7b2af9208e782369111f018b95b Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 4 Sep 2023 19:53:34 +0300 Subject: [PATCH 086/323] [#121] client: Make PrmAnnounceSpace fields public Signed-off-by: Airat Arifullin --- client/container_space.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/container_space.go b/client/container_space.go index af984e5..c066c0a 100644 --- a/client/container_space.go +++ b/client/container_space.go @@ -14,27 +14,29 @@ import ( // PrmAnnounceSpace groups parameters of ContainerAnnounceUsedSpace operation. type PrmAnnounceSpace struct { - prmCommonMeta + XHeaders []string - announcements []container.SizeEstimation + Announcements []container.SizeEstimation } // SetValues sets values describing volume of space that is used for the container objects. // Required parameter. Must not be empty. // // Must not be mutated before the end of the operation. +// +// Deprecated: Use PrmAnnounceSpace.Announcements instead. func (x *PrmAnnounceSpace) SetValues(vs []container.SizeEstimation) { - x.announcements = vs + x.Announcements = vs } func (x *PrmAnnounceSpace) buildRequest(c *Client) (*v2container.AnnounceUsedSpaceRequest, error) { - if len(x.announcements) == 0 { + if len(x.Announcements) == 0 { return nil, errorMissingAnnouncements } - v2announce := make([]v2container.UsedSpaceAnnouncement, len(x.announcements)) - for i := range x.announcements { - x.announcements[i].WriteToV2(&v2announce[i]) + v2announce := make([]v2container.UsedSpaceAnnouncement, len(x.Announcements)) + for i := range x.Announcements { + x.Announcements[i].WriteToV2(&v2announce[i]) } reqBody := new(v2container.AnnounceUsedSpaceRequestBody) From 55a1f23e7170a14ee2ba3b7203a5fb79bca713bd Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 4 Sep 2023 19:55:23 +0300 Subject: [PATCH 087/323] [#121] client: Make PrmEndpointInfo, PrmNetworkInfo fields public Signed-off-by: Airat Arifullin --- client/netmap.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/netmap.go b/client/netmap.go index b63ba65..80d1ded 100644 --- a/client/netmap.go +++ b/client/netmap.go @@ -16,12 +16,12 @@ import ( // PrmEndpointInfo groups parameters of EndpointInfo operation. type PrmEndpointInfo struct { - prmCommonMeta + XHeaders []string } func (x *PrmEndpointInfo) buildRequest(c *Client) (*v2netmap.LocalNodeInfoRequest, error) { meta := new(v2session.RequestMetaHeader) - writeXHeadersToMeta(x.xHeaders, meta) + writeXHeadersToMeta(x.XHeaders, meta) req := new(v2netmap.LocalNodeInfoRequest) req.SetBody(new(v2netmap.LocalNodeInfoRequestBody)) @@ -112,12 +112,12 @@ func (c *Client) EndpointInfo(ctx context.Context, prm PrmEndpointInfo) (*ResEnd // PrmNetworkInfo groups parameters of NetworkInfo operation. type PrmNetworkInfo struct { - prmCommonMeta + XHeaders []string } func (x PrmNetworkInfo) buildRequest(c *Client) (*v2netmap.NetworkInfoRequest, error) { meta := new(v2session.RequestMetaHeader) - writeXHeadersToMeta(x.xHeaders, meta) + writeXHeadersToMeta(x.XHeaders, meta) var req v2netmap.NetworkInfoRequest req.SetBody(new(v2netmap.NetworkInfoRequestBody)) From 55699d14807b7dbf5e801ddd55302019632898cb Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 5 Sep 2023 17:30:42 +0300 Subject: [PATCH 088/323] [#121] client: Make PrmSessionCreate fields public Signed-off-by: Airat Arifullin --- client/session.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/client/session.go b/client/session.go index 3e1180e..b3ec722 100644 --- a/client/session.go +++ b/client/session.go @@ -16,30 +16,32 @@ import ( // PrmSessionCreate groups parameters of SessionCreate operation. type PrmSessionCreate struct { - prmCommonMeta + XHeaders []string - exp uint64 + Expiration uint64 - keySet bool - key ecdsa.PrivateKey + Key *ecdsa.PrivateKey } // SetExp sets number of the last NepFS epoch in the lifetime of the session after which it will be expired. +// +// Deprecated: Use PrmSessionCreate.Expiration instead. func (x *PrmSessionCreate) SetExp(exp uint64) { - x.exp = exp + x.Expiration = exp } // UseKey specifies private key to sign the requests and compute token owner. // If key is not provided, then Client default key is used. +// +// Deprecated: Use PrmSessionCreate.Key instead. func (x *PrmSessionCreate) UseKey(key ecdsa.PrivateKey) { - x.keySet = true - x.key = key + x.Key = &key } func (x *PrmSessionCreate) buildRequest(c *Client) (*v2session.CreateRequest, error) { ownerKey := c.prm.key.PublicKey - if x.keySet { - ownerKey = x.key.PublicKey + if x.Key != nil { + ownerKey = x.Key.PublicKey } var ownerID user.ID user.IDFromKey(&ownerID, ownerKey) @@ -49,10 +51,10 @@ func (x *PrmSessionCreate) buildRequest(c *Client) (*v2session.CreateRequest, er reqBody := new(v2session.CreateRequestBody) reqBody.SetOwnerID(&ownerIDV2) - reqBody.SetExpiration(x.exp) + reqBody.SetExpiration(x.Expiration) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.xHeaders, &meta) + writeXHeadersToMeta(x.XHeaders, &meta) var req v2session.CreateRequest req.SetBody(reqBody) From 303508328a1ce578c0512067797f742f821e5b10 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 5 Sep 2023 17:32:03 +0300 Subject: [PATCH 089/323] [#121] pool: Refactor PrmSessionCreate usage Signed-off-by: Airat Arifullin --- pool/pool.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 6dc8fb9..aebd5d1 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -983,9 +983,10 @@ func (c *clientWrapper) sessionCreate(ctx context.Context, prm prmCreateSession) return resCreateSession{}, err } - var cliPrm sdkClient.PrmSessionCreate - cliPrm.SetExp(prm.exp) - cliPrm.UseKey(prm.key) + cliPrm := sdkClient.PrmSessionCreate{ + Expiration: prm.exp, + Key: &prm.key, + } start := time.Now() res, err := cl.SessionCreate(ctx, cliPrm) From aa12d8c6a6dc42f5fe0049b3cdeb1993297145a9 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 4 Sep 2023 12:42:55 +0300 Subject: [PATCH 090/323] [#121] client: Make PrmObjectHash fields public * Introduce buildRequest for PrmObjectHash Signed-off-by: Airat Arifullin --- client/object_hash.go | 215 ++++++++++++++++++++---------------------- 1 file changed, 101 insertions(+), 114 deletions(-) diff --git a/client/object_hash.go b/client/object_hash.go index 6df0d7a..7fdf335 100644 --- a/client/object_hash.go +++ b/client/object_hash.go @@ -13,121 +13,53 @@ import ( v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" ) // PrmObjectHash groups parameters of ObjectHash operation. type PrmObjectHash struct { - meta v2session.RequestMetaHeader + XHeaders []string - body v2object.GetRangeHashRequestBody + BearerToken *bearer.Token - csAlgo v2refs.ChecksumType + Session *session.Object - addr v2refs.Address + Local bool - keySet bool - key ecdsa.PrivateKey + Ranges []object.Range + + Salt []byte + + ChecksumType checksum.Type + + ContainerID *cid.ID + + ObjectID *oid.ID + + Key *ecdsa.PrivateKey } // UseKey specifies private key to sign the requests. // If key is not provided, then Client default key is used. -func (x *PrmObjectHash) UseKey(key ecdsa.PrivateKey) { - x.keySet = true - x.key = key -} - -// MarkLocal tells the server to execute the operation locally. -func (x *PrmObjectHash) MarkLocal() { - x.meta.SetTTL(1) -} - -// WithinSession specifies session within which object should be read. // -// Creator of the session acquires the authorship of the request. -// This may affect the execution of an operation (e.g. access control). -// -// Must be signed. -func (x *PrmObjectHash) WithinSession(t session.Object) { - var tv2 v2session.Token - t.WriteToV2(&tv2) - - x.meta.SetSessionToken(&tv2) -} - -// WithBearerToken attaches bearer token to be used for the operation. -// -// If set, underlying eACL rules will be used in access control. -// -// Must be signed. -func (x *PrmObjectHash) WithBearerToken(t bearer.Token) { - var v2token acl.BearerToken - t.WriteToV2(&v2token) - x.meta.SetBearerToken(&v2token) -} - -// FromContainer specifies FrostFS container of the object. -// Required parameter. -func (x *PrmObjectHash) FromContainer(id cid.ID) { - var cidV2 v2refs.ContainerID - id.WriteToV2(&cidV2) - - x.addr.SetContainerID(&cidV2) -} - -// ByID specifies identifier of the requested object. -// Required parameter. -func (x *PrmObjectHash) ByID(id oid.ID) { - var idV2 v2refs.ObjectID - id.WriteToV2(&idV2) - - x.addr.SetObjectID(&idV2) -} - -// SetRangeList sets list of ranges in (offset, length) pair format. -// Required parameter. -// -// If passed as slice, then it must not be mutated before the operation completes. -func (x *PrmObjectHash) SetRangeList(r ...uint64) { - ln := len(r) - if ln%2 != 0 { - panic("odd number of range parameters") - } - - rs := make([]v2object.Range, ln/2) - - for i := 0; i < ln/2; i++ { - rs[i].SetOffset(r[2*i]) - rs[i].SetLength(r[2*i+1]) - } - - x.body.SetRanges(rs) +// Deprecated: Use PrmObjectHash.Key instead. +func (prm *PrmObjectHash) UseKey(key ecdsa.PrivateKey) { + prm.Key = &key } // TillichZemorAlgo changes the hash function to Tillich-Zemor // (https://link.springer.com/content/pdf/10.1007/3-540-48658-5_5.pdf). // -// By default, SHA256 hash function is used. -func (x *PrmObjectHash) TillichZemorAlgo() { - x.csAlgo = v2refs.TillichZemor -} - -// UseSalt sets the salt to XOR the data range before hashing. +// By default, SHA256 hash function is used/. // -// Must not be mutated before the operation completes. -func (x *PrmObjectHash) UseSalt(salt []byte) { - x.body.SetSalt(salt) -} - -// WithXHeaders specifies list of extended headers (string key-value pairs) -// to be attached to the request. Must have an even length. -// -// Slice must not be mutated until the operation completes. -func (x *PrmObjectHash) WithXHeaders(hs ...string) { - writeXHeadersToMeta(hs, &x.meta) +// Deprecated: Use PrmObjectHash.ChecksumType instead. +func (prm *PrmObjectHash) TillichZemorAlgo() { + prm.ChecksumType = checksum.TZ } // ResObjectHash groups resulting values of ObjectHash operation. @@ -142,6 +74,76 @@ func (x ResObjectHash) Checksums() [][]byte { return x.checksums } +func (prm *PrmObjectHash) buildRequest(c *Client) (*v2object.GetRangeHashRequest, error) { + if prm.ContainerID == nil { + return nil, errorMissingContainer + } + + if prm.ObjectID == nil { + return nil, errorMissingObject + } + + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + if len(prm.Ranges) == 0 { + return nil, errorMissingRanges + } + + meta := new(v2session.RequestMetaHeader) + writeXHeadersToMeta(prm.XHeaders, meta) + + if prm.BearerToken != nil { + v2BearerToken := new(acl.BearerToken) + prm.BearerToken.WriteToV2(v2BearerToken) + meta.SetBearerToken(v2BearerToken) + } + + if prm.Session != nil { + v2SessionToken := new(v2session.Token) + prm.Session.WriteToV2(v2SessionToken) + meta.SetSessionToken(v2SessionToken) + } + + if prm.Local { + meta.SetTTL(1) + } + + addr := new(v2refs.Address) + + cnrV2 := new(v2refs.ContainerID) + prm.ContainerID.WriteToV2(cnrV2) + addr.SetContainerID(cnrV2) + + objV2 := new(v2refs.ObjectID) + prm.ObjectID.WriteToV2(objV2) + addr.SetObjectID(objV2) + + rs := make([]v2object.Range, len(prm.Ranges)) + for i := range prm.Ranges { + rs[i].SetOffset(prm.Ranges[i].GetOffset()) + rs[i].SetLength(prm.Ranges[i].GetLength()) + } + + body := new(v2object.GetRangeHashRequestBody) + body.SetAddress(addr) + body.SetRanges(rs) + body.SetSalt(prm.Salt) + + if prm.ChecksumType == checksum.Unknown { + body.SetType(v2refs.SHA256) + } else { + body.SetType(v2refs.ChecksumType(prm.ChecksumType)) + } + + req := new(v2object.GetRangeHashRequest) + req.SetBody(body) + c.prepareRequest(req, meta) + + return req, nil +} + // ObjectHash requests checksum of the range list of the object payload using // FrostFS API protocol. // @@ -165,37 +167,22 @@ func (x ResObjectHash) Checksums() [][]byte { // - *apistatus.ObjectOutOfRange; // - *apistatus.SessionTokenExpired. func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectHash, error) { - switch { - case prm.addr.GetContainerID() == nil: - return nil, errorMissingContainer - case prm.addr.GetObjectID() == nil: - return nil, errorMissingObject - case len(prm.body.GetRanges()) == 0: - return nil, errorMissingRanges + req, err := prm.buildRequest(c) + if err != nil { + return nil, err } - prm.body.SetAddress(&prm.addr) - if prm.csAlgo == v2refs.UnknownChecksum { - prm.body.SetType(v2refs.SHA256) - } else { - prm.body.SetType(prm.csAlgo) - } - - var req v2object.GetRangeHashRequest - c.prepareRequest(&req, &prm.meta) - req.SetBody(&prm.body) - key := c.prm.key - if prm.keySet { - key = prm.key + if prm.Key != nil { + key = *prm.Key } - err := signature.SignServiceMessage(&key, &req) + err = signature.SignServiceMessage(&key, req) if err != nil { return nil, fmt.Errorf("sign request: %w", err) } - resp, err := rpcapi.HashObjectRange(&c.c, &req, client.WithContext(ctx)) + resp, err := rpcapi.HashObjectRange(&c.c, req, client.WithContext(ctx)) if err != nil { return nil, fmt.Errorf("write request: %w", err) } From 49ad985cadd2a86955aae557e5ab43f1a1af5e02 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 8 Sep 2023 17:15:08 +0300 Subject: [PATCH 091/323] [#161] *: Do not use math/rand.Read() Signed-off-by: Evgenii Stratonikov --- checksum/example_test.go | 2 +- checksum/test/generate.go | 4 ++-- container/id/id_test.go | 2 +- container/id/test/id.go | 4 ++-- crypto/crypto_test.go | 2 +- eacl/test/benchmark_test.go | 2 +- eacl/validator_test.go | 2 +- netmap/selector_test.go | 7 ++++--- netmap/test/generate.go | 4 ++-- ns/nns_test.go | 2 +- object/id/test/generate.go | 4 ++-- object/search_test.go | 2 +- object/tombstone_test.go | 2 +- session/container_test.go | 5 +++-- user/id_test.go | 2 +- 15 files changed, 24 insertions(+), 22 deletions(-) diff --git a/checksum/example_test.go b/checksum/example_test.go index d98c992..337767a 100644 --- a/checksum/example_test.go +++ b/checksum/example_test.go @@ -2,9 +2,9 @@ package checksum import ( "bytes" + "crypto/rand" "crypto/sha256" "fmt" - "math/rand" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) diff --git a/checksum/test/generate.go b/checksum/test/generate.go index d8c6b0b..06c9059 100644 --- a/checksum/test/generate.go +++ b/checksum/test/generate.go @@ -1,8 +1,8 @@ package checksumtest import ( + "crypto/rand" "crypto/sha256" - "math/rand" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" ) @@ -11,7 +11,7 @@ import ( func Checksum() checksum.Checksum { var cs [sha256.Size]byte - rand.Read(cs[:]) + _, _ = rand.Read(cs[:]) var x checksum.Checksum diff --git a/container/id/id_test.go b/container/id/id_test.go index ad12295..ded7457 100644 --- a/container/id/id_test.go +++ b/container/id/id_test.go @@ -1,8 +1,8 @@ package cid_test import ( + "crypto/rand" "crypto/sha256" - "math/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" diff --git a/container/id/test/id.go b/container/id/test/id.go index 2ebcf09..6790b22 100644 --- a/container/id/test/id.go +++ b/container/id/test/id.go @@ -1,8 +1,8 @@ package cidtest import ( + "crypto/rand" "crypto/sha256" - "math/rand" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" ) @@ -11,7 +11,7 @@ import ( func ID() cid.ID { checksum := [sha256.Size]byte{} - rand.Read(checksum[:]) + _, _ = rand.Read(checksum[:]) return IDWithChecksum(checksum) } diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 095cdd9..7d1ad52 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -1,7 +1,7 @@ package frostfscrypto_test import ( - "math/rand" + "crypto/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" diff --git a/eacl/test/benchmark_test.go b/eacl/test/benchmark_test.go index cc2c3d0..865789b 100644 --- a/eacl/test/benchmark_test.go +++ b/eacl/test/benchmark_test.go @@ -2,7 +2,7 @@ package eacltest import ( "bytes" - "math/rand" + "crypto/rand" "testing" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" diff --git a/eacl/validator_test.go b/eacl/validator_test.go index 3b8d9f1..582a6bc 100644 --- a/eacl/validator_test.go +++ b/eacl/validator_test.go @@ -1,7 +1,7 @@ package eacl import ( - "math/rand" + "crypto/rand" "testing" "github.com/stretchr/testify/require" diff --git a/netmap/selector_test.go b/netmap/selector_test.go index ccb5eb2..759e7ee 100644 --- a/netmap/selector_test.go +++ b/netmap/selector_test.go @@ -1,9 +1,10 @@ package netmap import ( + "crypto/rand" "encoding/binary" "fmt" - "math/rand" + mrand "math/rand" "sort" "strconv" "testing" @@ -28,10 +29,10 @@ func BenchmarkHRWSort(b *testing.B) { node.SetPublicKey(key) vectors[i] = nodes{node} - weights[i] = float64(rand.Uint32()%10) / 10.0 + weights[i] = float64(mrand.Uint32()%10) / 10.0 } - pivot := rand.Uint64() + pivot := mrand.Uint64() b.Run("sort by index, no weight", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 3f5f26b..19c3514 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -1,7 +1,7 @@ package netmaptest import ( - "math/rand" + "crypto/rand" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" ) @@ -70,7 +70,7 @@ func NetworkInfo() (x netmap.NetworkInfo) { // NodeInfo returns random netmap.NodeInfo. func NodeInfo() (x netmap.NodeInfo) { key := make([]byte, 33) - rand.Read(key) + _, _ = rand.Read(key) x.SetPublicKey(key) x.SetNetworkEndpoints("1", "2", "3") diff --git a/ns/nns_test.go b/ns/nns_test.go index 9970b88..669f4af 100644 --- a/ns/nns_test.go +++ b/ns/nns_test.go @@ -1,10 +1,10 @@ package ns import ( + "crypto/rand" "errors" "fmt" "math/big" - "math/rand" "strings" "testing" diff --git a/object/id/test/generate.go b/object/id/test/generate.go index e51405d..0da4119 100644 --- a/object/id/test/generate.go +++ b/object/id/test/generate.go @@ -1,8 +1,8 @@ package oidtest import ( + "crypto/rand" "crypto/sha256" - "math/rand" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -12,7 +12,7 @@ import ( func ID() oid.ID { checksum := [sha256.Size]byte{} - rand.Read(checksum[:]) + _, _ = rand.Read(checksum[:]) return idWithChecksum(checksum) } diff --git a/object/search_test.go b/object/search_test.go index d0f36de..40df23b 100644 --- a/object/search_test.go +++ b/object/search_test.go @@ -1,8 +1,8 @@ package object_test import ( + "crypto/rand" "crypto/sha256" - "math/rand" "testing" v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" diff --git a/object/tombstone_test.go b/object/tombstone_test.go index cd74e45..9825133 100644 --- a/object/tombstone_test.go +++ b/object/tombstone_test.go @@ -1,8 +1,8 @@ package object import ( + "crypto/rand" "crypto/sha256" - "math/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone" diff --git a/session/container_test.go b/session/container_test.go index a152e31..d3d4662 100644 --- a/session/container_test.go +++ b/session/container_test.go @@ -1,9 +1,10 @@ package session_test import ( + "crypto/rand" "fmt" "math" - "math/rand" + mrand "math/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" @@ -396,7 +397,7 @@ func TestContainer_AppliedTo(t *testing.T) { func TestContainer_InvalidAt(t *testing.T) { var x session.Container - nbf := rand.Uint64() + nbf := mrand.Uint64() if nbf == math.MaxUint64 { nbf-- } diff --git a/user/id_test.go b/user/id_test.go index 27d93dc..30e19db 100644 --- a/user/id_test.go +++ b/user/id_test.go @@ -1,7 +1,7 @@ package user_test import ( - "math/rand" + "crypto/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" From 8bc64e088ec04801f5128893d5ce30c9ff3fc48a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 8 Sep 2023 17:15:53 +0300 Subject: [PATCH 092/323] [#161] .golangci.yml: Reenable deprecated usage warnings Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index fae355a..aca0746 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -25,7 +25,7 @@ linters-settings: # report about shadowed variables check-shadowing: false staticcheck: - checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed. + checks: ["all"] funlen: lines: 80 # default 60 statements: 60 # default 40 From 4df642e94119afbadcdca5142ad05ea2af6230d1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 11 Sep 2023 15:12:55 +0300 Subject: [PATCH 093/323] [#162] netmap: Fix possible panic Placement policy is unvalidated external input. Under no circumstances should we panic here. Signed-off-by: Evgenii Stratonikov --- netmap/netmap.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netmap/netmap.go b/netmap/netmap.go index 3e8d680..37f5cab 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -258,6 +258,9 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e } if p.unique { + if c.processedSelectors[sName] == nil { + return nil, fmt.Errorf("selector not found: '%s'", sName) + } nodes, err := c.getSelection(*c.processedSelectors[sName]) if err != nil { return nil, err From 0a0b590df38aa9af77ecc89cbda7b75818e97bfb Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 11 Sep 2023 15:21:35 +0300 Subject: [PATCH 094/323] [#162] Fix pre-commit warnings Signed-off-by: Evgenii Stratonikov --- doc/image/filter_illustration.svg | 2 +- doc/image/placement_policy.svg | 2 +- doc/image/rep_illustration.svg | 2 +- doc/image/sample_netmap.svg | 2 +- doc/image/select_illustration.svg | 2 +- doc/policy.md | 20 ++++++++++---------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/image/filter_illustration.svg b/doc/image/filter_illustration.svg index a57aa68..7eedf3d 100644 --- a/doc/image/filter_illustration.svg +++ b/doc/image/filter_illustration.svg @@ -1,4 +1,4 @@ -
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
*
*
MyNodes
MyNodes
Text is not SVG - cannot display
\ No newline at end of file +
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
*
*
MyNodes
MyNodes
Text is not SVG - cannot display
diff --git a/doc/image/placement_policy.svg b/doc/image/placement_policy.svg index 9cc8a1a..2820c64 100644 --- a/doc/image/placement_policy.svg +++ b/doc/image/placement_policy.svg @@ -1,4 +1,4 @@ -
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
SELECT
SELECT
SELECT
SELECT
SELECT
SELECT
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
REP
REP
REP
REP
REP
REP
netmap
netmap
Text is not SVG - cannot display
\ No newline at end of file +
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
SELECT
SELECT
SELECT
SELECT
SELECT
SELECT
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
REP
REP
REP
REP
REP
REP
netmap
netmap
Text is not SVG - cannot display
diff --git a/doc/image/rep_illustration.svg b/doc/image/rep_illustration.svg index 8bcc327..6955499 100644 --- a/doc/image/rep_illustration.svg +++ b/doc/image/rep_illustration.svg @@ -1,4 +1,4 @@ -
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
REP 1 IN MyNodes
REP 1 IN MyNodes
Text is not SVG - cannot display
\ No newline at end of file +
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
REP 1 IN MyNodes
REP 1 IN MyNodes
Text is not SVG - cannot display
diff --git a/doc/image/sample_netmap.svg b/doc/image/sample_netmap.svg index 3d0b39f..ea4928e 100644 --- a/doc/image/sample_netmap.svg +++ b/doc/image/sample_netmap.svg @@ -1,4 +1,4 @@ -
C
C
A
A
Netmap
Netmap
B
B
D
D
E
E
F
F
G
G
H
H
I
I
Text is not SVG - cannot display
\ No newline at end of file +
C
C
A
A
Netmap
Netmap
B
B
D
D
E
E
F
F
G
G
H
H
I
I
Text is not SVG - cannot display
diff --git a/doc/image/select_illustration.svg b/doc/image/select_illustration.svg index 3a0956a..83ee783 100644 --- a/doc/image/select_illustration.svg +++ b/doc/image/select_illustration.svg @@ -1,4 +1,4 @@ -
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
RedOrBlueNodes
RedOrBlueNodes
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
Text is not SVG - cannot display
\ No newline at end of file +
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
RedOrBlueNodes
RedOrBlueNodes
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
Text is not SVG - cannot display
diff --git a/doc/policy.md b/doc/policy.md index 6818468..c7597ea 100644 --- a/doc/policy.md +++ b/doc/policy.md @@ -101,16 +101,16 @@ In a nutshell, a `SELECT` takes a filter result as input and outputs a specific Let's see some examples ```sql -- Selects exactly one node from the entire netmap -SELECT 1 FROM * +SELECT 1 FROM * -- Same as above, but with an identifier for the selection -SELECT 1 FROM * AS ONE +SELECT 1 FROM * AS ONE --- Selects two nodes from the RedOrBlueNodes filter, such that both selected nodes +-- Selects two nodes from the RedOrBlueNodes filter, such that both selected nodes -- share the same value for the Color attribute, i.e. both red or both blue. -SELECT 2 IN SAME Color FROM RedOrBlueNodes +SELECT 2 IN SAME Color FROM RedOrBlueNodes --- Selects two nodes from the RedOrBlueNodes filter, such that the selected nodes +-- Selects two nodes from the RedOrBlueNodes filter, such that the selected nodes -- have distinct values for the Color attribute, i.e. one red and one blue. -- The selection is also given an identifier. SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes @@ -173,18 +173,18 @@ In additional to this basic syntax, there are a couple of additional useful opti ### The policy playground -> ℹ️ This section assumes you have an up-to-date version of the `frostfs-cli`. +> ℹ️ This section assumes you have an up-to-date version of the `frostfs-cli`. While simple placement policies have predictable results that can be understood at a glance, more complex ones need careful consideration before deployment. In order to simplify understanding a policy's outcome and experimenting while learning, a builtin tool is provided as part of the `frostfs-cli` for this purpose: the policy playground. -For the remainder of this guide, we will use the policy playground to setup a virtual netmap (that is, one that doesn't require any networking or deployment) and test various policies. In order to visualize this netmap easily, each node will have three attributes: a character, a shape and a color +For the remainder of this guide, we will use the policy playground to setup a virtual netmap (that is, one that doesn't require any networking or deployment) and test various policies. In order to visualize this netmap easily, each node will have three attributes: a character, a shape and a color ![Sample Netmap](./image/sample_netmap.svg) We can start the policy playground as follows: ```sh $ frostfs-cli container policy-playground -> +> ``` Since we didn't pass any endpoint, the initial netmap is empty, which we can verify with the `ls` command (to list the nodes in the netmap): @@ -400,7 +400,7 @@ FILTER Color EQ 'Green' AS GreenNodes #### Example #6 ```sql REP 1 IN MyNodes -REP 2 +REP 2 CBF 2 SELECT 1 FROM CuteNodes AS MyNodes FILTER (Color EQ 'Blue') AND NOT (Shape EQ 'Circle' OR Shape EQ 'Square') AS CuteNodes @@ -442,4 +442,4 @@ Others: - `ls`: list nodes in the current netmap and their attributes - `add`: add a node to the current netmap. If it already exists, it will be overwritten. - `remove`: remove a node from the current netmap. -- `eval`: evaluate a placement policy on the current netmap. \ No newline at end of file +- `eval`: evaluate a placement policy on the current netmap. From ac8fc6d4400c4b842fc77d993d2a13598c51970d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 8 Sep 2023 16:57:41 +0300 Subject: [PATCH 095/323] [#162] netmap: Allow to parse single unnamed selectors Signed-off-by: Evgenii Stratonikov --- doc/policy.md | 3 ++- netmap/netmap.go | 2 +- netmap/policy.go | 5 ++-- netmap/policy_decode_test.go | 12 ++++++--- netmap/selector_test.go | 49 ++++++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 8 deletions(-) diff --git a/doc/policy.md b/doc/policy.md index c7597ea..28744ef 100644 --- a/doc/policy.md +++ b/doc/policy.md @@ -131,7 +131,8 @@ Its basic syntax is as follows: REP {IN