logtail: delete ID types and functions (#7412)

These have been moved to the types/logid package.

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
pull/7415/head
Joe Tsai 2 years ago committed by GitHub
parent 9cb332f0e2
commit 7e4788e383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
}

@ -26,6 +26,7 @@ import (
"tailscale.com/net/interfaces" "tailscale.com/net/interfaces"
"tailscale.com/net/sockstats" "tailscale.com/net/sockstats"
tslogger "tailscale.com/types/logger" tslogger "tailscale.com/types/logger"
"tailscale.com/types/logid"
"tailscale.com/util/set" "tailscale.com/util/set"
"tailscale.com/wgengine/monitor" "tailscale.com/wgengine/monitor"
) )
@ -49,8 +50,8 @@ type Encoder interface {
type Config struct { type Config struct {
Collection string // collection name, a domain name Collection string // collection name, a domain name
PrivateID PrivateID // private ID for the primary log stream PrivateID logid.PrivateID // private ID for the primary log stream
CopyPrivateID PrivateID // private ID for a log stream that is a superset of this 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" BaseURL string // if empty defaults to "https://log.tailscale.io"
HTTPC *http.Client // if empty defaults to http.DefaultClient HTTPC *http.Client // if empty defaults to http.DefaultClient
SkipClientTime bool // if true, client_time is not written to logs SkipClientTime bool // if true, client_time is not written to logs
@ -189,7 +190,7 @@ type Logger struct {
uploadCancel func() uploadCancel func()
explainedRaw bool explainedRaw bool
metricsDelta func() string // or nil metricsDelta func() string // or nil
privateID PrivateID privateID logid.PrivateID
httpDoCalls atomic.Int32 httpDoCalls atomic.Int32
procID uint32 procID uint32
@ -222,7 +223,7 @@ func (l *Logger) SetLinkMonitor(lm *monitor.Mon) {
// PrivateID returns the logger's private log ID. // PrivateID returns the logger's private log ID.
// //
// It exists for internal use only. // 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 // Shutdown gracefully shuts down the logger while completing any
// remaining uploads. // remaining uploads.

@ -15,6 +15,7 @@ import (
"time" "time"
"tailscale.com/tstest" "tailscale.com/tstest"
"tailscale.com/types/logid"
) )
func TestFastShutdown(t *testing.T) { func TestFastShutdown(t *testing.T) {
@ -299,7 +300,7 @@ func TestPublicIDUnmarshalText(t *testing.T) {
const hexStr = "6c60a9e0e7af57170bb1347b2d477e4cbc27d4571a4923b21651456f931e3d55" const hexStr = "6c60a9e0e7af57170bb1347b2d477e4cbc27d4571a4923b21651456f931e3d55"
x := []byte(hexStr) x := []byte(hexStr)
var id PublicID var id logid.PublicID
if err := id.UnmarshalText(x); err != nil { if err := id.UnmarshalText(x); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -307,7 +308,7 @@ func TestPublicIDUnmarshalText(t *testing.T) {
t.Errorf("String = %q; want %q", id.String(), hexStr) t.Errorf("String = %q; want %q", id.String(), hexStr)
} }
err := tstest.MinAllocsPerRun(t, 0, func() { err := tstest.MinAllocsPerRun(t, 0, func() {
var id PublicID var id logid.PublicID
if err := id.UnmarshalText(x); err != nil { if err := id.UnmarshalText(x); err != nil {
t.Fatal(err) t.Fatal(err)
} }

Loading…
Cancel
Save