From 7e4788e383115d40544639c608b9ce500051cee3 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 1 Mar 2023 12:18:23 -0800 Subject: [PATCH] logtail: delete ID types and functions (#7412) These have been moved to the types/logid package. Signed-off-by: Joe Tsai --- logtail/id.go | 27 --------------------------- logtail/logtail.go | 9 +++++---- logtail/logtail_test.go | 5 +++-- 3 files changed, 8 insertions(+), 33 deletions(-) delete mode 100644 logtail/id.go diff --git a/logtail/id.go b/logtail/id.go deleted file mode 100644 index ab07fc22c..000000000 --- a/logtail/id.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Tailscale Inc & AUTHORS -// SPDX-License-Identifier: BSD-3-Clause - -package logtail - -import "tailscale.com/types/logid" - -// Deprecated: Use "tailscale.com/types/logid".PrivateID instead. -type PrivateID = logid.PrivateID - -// Deprecated: Use "tailscale.com/types/logid".NewPrivateID instead. -func NewPrivateID() (PrivateID, error) { - return logid.NewPrivateID() -} - -// Deprecated: Use "tailscale.com/types/logid".ParsePrivateID instead. -func ParsePrivateID(s string) (PrivateID, error) { - return logid.ParsePrivateID(s) -} - -// Deprecated: Use "tailscale.com/types/logid".PublicID instead. -type PublicID = logid.PublicID - -// Deprecated: Use "tailscale.com/types/logid".ParsePublicID instead. -func ParsePublicID(s string) (PublicID, error) { - return logid.ParsePublicID(s) -} diff --git a/logtail/logtail.go b/logtail/logtail.go index 7f19e3a84..c3a4242f4 100644 --- a/logtail/logtail.go +++ b/logtail/logtail.go @@ -26,6 +26,7 @@ import ( "tailscale.com/net/interfaces" "tailscale.com/net/sockstats" tslogger "tailscale.com/types/logger" + "tailscale.com/types/logid" "tailscale.com/util/set" "tailscale.com/wgengine/monitor" ) @@ -49,8 +50,8 @@ type Encoder interface { type Config struct { Collection string // collection name, a domain name - PrivateID PrivateID // private ID for the primary log stream - CopyPrivateID PrivateID // private ID for a log stream that is a superset of this log stream + PrivateID logid.PrivateID // private ID for the primary log stream + CopyPrivateID logid.PrivateID // private ID for a log stream that is a superset of this log stream BaseURL string // if empty defaults to "https://log.tailscale.io" HTTPC *http.Client // if empty defaults to http.DefaultClient SkipClientTime bool // if true, client_time is not written to logs @@ -189,7 +190,7 @@ type Logger struct { uploadCancel func() explainedRaw bool metricsDelta func() string // or nil - privateID PrivateID + privateID logid.PrivateID httpDoCalls atomic.Int32 procID uint32 @@ -222,7 +223,7 @@ func (l *Logger) SetLinkMonitor(lm *monitor.Mon) { // PrivateID returns the logger's private log ID. // // It exists for internal use only. -func (l *Logger) PrivateID() PrivateID { return l.privateID } +func (l *Logger) PrivateID() logid.PrivateID { return l.privateID } // Shutdown gracefully shuts down the logger while completing any // remaining uploads. diff --git a/logtail/logtail_test.go b/logtail/logtail_test.go index d20e50916..18c3408ee 100644 --- a/logtail/logtail_test.go +++ b/logtail/logtail_test.go @@ -15,6 +15,7 @@ import ( "time" "tailscale.com/tstest" + "tailscale.com/types/logid" ) func TestFastShutdown(t *testing.T) { @@ -299,7 +300,7 @@ func TestPublicIDUnmarshalText(t *testing.T) { const hexStr = "6c60a9e0e7af57170bb1347b2d477e4cbc27d4571a4923b21651456f931e3d55" x := []byte(hexStr) - var id PublicID + var id logid.PublicID if err := id.UnmarshalText(x); err != nil { t.Fatal(err) } @@ -307,7 +308,7 @@ func TestPublicIDUnmarshalText(t *testing.T) { t.Errorf("String = %q; want %q", id.String(), hexStr) } err := tstest.MinAllocsPerRun(t, 0, func() { - var id PublicID + var id logid.PublicID if err := id.UnmarshalText(x); err != nil { t.Fatal(err) }