diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-01-22 16:07:17 +0100 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-01-23 10:42:36 +0000 |
| commit | 7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch) | |
| tree | e6fec4fd12ff807a16d847923f501075bf71d16c /vendor/cloud.google.com/go/pubsub/debug.go | |
| parent | 475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff) | |
vendor: delete
Diffstat (limited to 'vendor/cloud.google.com/go/pubsub/debug.go')
| -rw-r--r-- | vendor/cloud.google.com/go/pubsub/debug.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/vendor/cloud.google.com/go/pubsub/debug.go b/vendor/cloud.google.com/go/pubsub/debug.go deleted file mode 100644 index 056bd6342..000000000 --- a/vendor/cloud.google.com/go/pubsub/debug.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build psdebug -// +build psdebug - -package pubsub - -import ( - "sync" - "time" -) - -var ( - dmu sync.Mutex - msgTraces = map[string][]Event{} - ackIDToMsgID = map[string]string{} -) - -type Event struct { - Desc string - At time.Time -} - -func MessageEvents(msgID string) []Event { - dmu.Lock() - defer dmu.Unlock() - return msgTraces[msgID] -} - -func addRecv(msgID, ackID string, t time.Time) { - dmu.Lock() - defer dmu.Unlock() - ackIDToMsgID[ackID] = msgID - addEvent(msgID, "recv", t) -} - -func addAcks(ackIDs []string) { - dmu.Lock() - defer dmu.Unlock() - now := time.Now() - for _, id := range ackIDs { - addEvent(ackIDToMsgID[id], "ack", now) - } -} - -func addModAcks(ackIDs []string, deadlineSecs int32) { - dmu.Lock() - defer dmu.Unlock() - desc := "modack" - if deadlineSecs == 0 { - desc = "nack" - } - now := time.Now() - for _, id := range ackIDs { - addEvent(ackIDToMsgID[id], desc, now) - } -} - -func addEvent(msgID, desc string, t time.Time) { - msgTraces[msgID] = append(msgTraces[msgID], Event{desc, t}) -} |
