debuginfo

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 28 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ChunkSize 8MB is the size of the chunks in which debuginfo files are
	// uploaded and downloaded. AWS S3 has a minimum of 5MB for multi-part uploads
	// and a maximum of 15MB, and a default of 8MB.
	ChunkSize = 1024 * 1024 * 8
	// MaxMsgSize is the maximum message size the server can receive or send. By default, it is 4MB.
	MaxMsgSize = 1024 * 1024 * 32
)

Variables

View Source
var (
	ErrMetadataShouldExist     = errors.New("debug info metadata should exist")
	ErrMetadataUnexpectedState = errors.New("debug info metadata state is unexpected")
	// There's no debug info metadata. This could mean that an older version
	// uploaded the debug info files, but there's no record of the metadata, yet.
	ErrMetadataNotFound = errors.New("debug info metadata not found")
)
View Source
var BucketValid = BucketRule{}
View Source
var ErrDebugInfoAlreadyExists = errors.New("debug info already exists")
View Source
var ErrDebugInfoNotFound = errors.New("debug info not found")
View Source
var Valid = ValidRule{}

Valid is the ValidRule.

Functions

This section is empty.

Types

type BucketRule added in v0.2.0

type BucketRule struct{}

func (BucketRule) Validate added in v0.2.0

func (r BucketRule) Validate(value interface{}) error

Validate the bucket config.

type CacheConfig

type CacheConfig struct {
	Type   CacheProvider `yaml:"type"`
	Config interface{}   `yaml:"config"`
}

type CacheProvider

type CacheProvider string
const (
	FILESYSTEM CacheProvider = "FILESYSTEM"
)

type Client added in v0.8.0

type Client struct {
	// contains filtered or unexported fields
}

func NewDebugInfoClient

func NewDebugInfoClient(conn *grpc.ClientConn) *Client

func (*Client) Downloader added in v0.12.0

func (c *Client) Downloader(ctx context.Context, buildID string) (*Downloader, error)

func (*Client) Exists added in v0.8.0

func (c *Client) Exists(ctx context.Context, buildID, hash string) (bool, error)

func (*Client) Upload added in v0.8.0

func (c *Client) Upload(ctx context.Context, buildID, hash string, r io.Reader) (uint64, error)

type Config

type Config struct {
	Bucket *client.BucketConfig `yaml:"bucket"`
	Cache  *CacheConfig         `yaml:"cache"`
}

type DebugInfodClient added in v0.8.0

type DebugInfodClient interface {
	GetDebugInfo(ctx context.Context, buildid string) (io.ReadCloser, error)
}

func NewDebugInfodClientWithObjectStorageCache added in v0.8.0

func NewDebugInfodClientWithObjectStorageCache(logger log.Logger, bucket objstore.Bucket, h DebugInfodClient) (DebugInfodClient, error)

NewDebugInfodClientWithObjectStorageCache creates a new DebugInfodClient that caches the debug information in the object storage.

type DebugInfodClientObjectStorageCache added in v0.8.0

type DebugInfodClientObjectStorageCache struct {
	// contains filtered or unexported fields
}

func (*DebugInfodClientObjectStorageCache) GetDebugInfo added in v0.8.0

func (c *DebugInfodClientObjectStorageCache) GetDebugInfo(ctx context.Context, buildID string) (io.ReadCloser, error)

GetDebugInfo returns debug info for given buildid while caching it in object storage.

type Downloader added in v0.12.0

type Downloader struct {
	// contains filtered or unexported fields
}

func (*Downloader) Close added in v0.12.0

func (d *Downloader) Close() error

func (*Downloader) Download added in v0.12.0

func (d *Downloader) Download(ctx context.Context, w io.Writer) (int, error)

func (*Downloader) Info added in v0.12.0

func (d *Downloader) Info() *debuginfopb.DownloadInfo

type FilesystemCacheConfig

type FilesystemCacheConfig struct {
	Directory string `yaml:"directory"`
}

func NewCache added in v0.12.0

func NewCache(cacheConf *CacheConfig) (*FilesystemCacheConfig, error)

type HTTPDebugInfodClient added in v0.8.0

type HTTPDebugInfodClient struct {
	UpstreamServers []*url.URL
	// contains filtered or unexported fields
}

func NewHTTPDebugInfodClient added in v0.8.0

func NewHTTPDebugInfodClient(logger log.Logger, serverURLs []string, timeoutDuration time.Duration) (*HTTPDebugInfodClient, error)

NewHTTPDebugInfodClient returns a new HTTP debug info client.

func (*HTTPDebugInfodClient) GetDebugInfo added in v0.8.0

func (c *HTTPDebugInfodClient) GetDebugInfo(ctx context.Context, buildID string) (io.ReadCloser, error)

GetDebugInfo returns debug information file for given buildID by downloading it from upstream servers.

type Metadata added in v0.12.0

type Metadata struct {
	State            MetadataState `json:"state"`
	BuildID          string        `json:"build_id"`
	Hash             string        `json:"hash"`
	UploadStartedAt  int64         `json:"upload_started_at"`
	UploadFinishedAt int64         `json:"upload_finished_at"`
}

type MetadataManager added in v0.12.0

type MetadataManager interface {
	MarkAsCorrupted(ctx context.Context, buildID string) error
	MarkAsUploading(ctx context.Context, buildID string) error
	MarkAsUploaded(ctx context.Context, buildID, hash string) error
	Fetch(ctx context.Context, buildID string) (*Metadata, error)
}

type MetadataState added in v0.12.0

type MetadataState int64
const (
	MetadataStateUnknown MetadataState = iota
	// The debug info file is being uploaded.
	MetadataStateUploading
	// The debug info file is fully uploaded.
	MetadataStateUploaded
	// The debug info file is corrupted.
	MetadataStateCorrupted
)

func (MetadataState) MarshalJSON added in v0.12.0

func (m MetadataState) MarshalJSON() ([]byte, error)

func (MetadataState) String added in v0.12.0

func (m MetadataState) String() string

func (*MetadataState) UnmarshalJSON added in v0.12.0

func (m *MetadataState) UnmarshalJSON(b []byte) error

type NopDebugInfodClient added in v0.9.0

type NopDebugInfodClient struct{}

func (NopDebugInfodClient) GetDebugInfo added in v0.9.0

type ObjectStoreMetadata added in v0.12.0

type ObjectStoreMetadata struct {
	// contains filtered or unexported fields
}

func NewObjectStoreMetadata added in v0.12.0

func NewObjectStoreMetadata(logger log.Logger, bucket objstore.Bucket) *ObjectStoreMetadata

func (*ObjectStoreMetadata) Fetch added in v0.12.0

func (m *ObjectStoreMetadata) Fetch(ctx context.Context, buildID string) (*Metadata, error)

func (*ObjectStoreMetadata) MarkAsCorrupted added in v0.12.0

func (m *ObjectStoreMetadata) MarkAsCorrupted(ctx context.Context, buildID string) error

func (*ObjectStoreMetadata) MarkAsUploaded added in v0.12.0

func (m *ObjectStoreMetadata) MarkAsUploaded(ctx context.Context, buildID, hash string) error

func (*ObjectStoreMetadata) MarkAsUploading added in v0.12.0

func (m *ObjectStoreMetadata) MarkAsUploading(ctx context.Context, buildID string) error

type Store

type Store struct {
	debuginfopb.UnimplementedDebugInfoServiceServer
	// contains filtered or unexported fields
}

func NewStore

func NewStore(
	logger log.Logger,
	cacheDir string,
	metadata MetadataManager,
	bucket objstore.Bucket,
	debuginfodClient DebugInfodClient,
) (*Store, error)

NewStore returns a new debug info store.

func (*Store) Download added in v0.12.0

func (*Store) Exists

func (*Store) FetchDebugInfo added in v0.12.0

func (s *Store) FetchDebugInfo(ctx context.Context, buildID string) (string, debuginfopb.DownloadInfo_Source, error)

func (*Store) Upload

type UploadReader

type UploadReader struct {
	// contains filtered or unexported fields
}

func (*UploadReader) Read

func (r *UploadReader) Read(p []byte) (int, error)

type ValidRule added in v0.2.0

type ValidRule struct{}

ValidRule is a validation rule for the Config. It implements the validation.Rule interface.

func (ValidRule) Validate added in v0.2.0

func (v ValidRule) Validate(value interface{}) error

Validate returns an error if the config is not valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL