{"modulePath":"github.com/chainloop-dev/chainloop","version":"v1.138.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package casclient\n\n## Functions\n\n```go\nfunc Digest(r io.ReadSeeker) (string, error)\n```\nDigest returns the digest of the content as the CAS stores it, i.e sha256:\\[hex]. It rewinds r, so the hashed content can then be uploaded from the same reader.\n\n## Types\n\n```go\ntype CASBackend struct {\n\tUploader Uploader\n\t// Max number of bytes this backend can store per artifact\n\tMaxSize int64\n\t// CAS backend name\n\tName string\n}\n```\n\n```go\ntype Client struct {\n\n\t// channel to send progress status to the go-routine that's rendering the progress bar\n\tProgressStatus ProgressStatusChan\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(conn *grpc.ClientConn, opts ...ClientOpts) *Client\n```\n\n```go\nfunc (c *Client) Describe(ctx context.Context, digest string) (*ResourceInfo, error)\n```\nDescribe returns the metadata of a resource by its digest We use this to get the filename and the total size of the artifact\n\n```go\nfunc (c *Client) Download(ctx context.Context, w io.Writer, digest string) error\n```\nDownload downloads a file from the CAS and writes it to the provided writer\n\n```go\nfunc (c *Client) IsReady(ctx context.Context) (bool, error)\n```\nContact the API to check if the service is ready to accept connections\n\n```go\nfunc (c *Client) Upload(ctx context.Context, r io.Reader, filename, digest string) (*UpDownStatus, error)\n```\n\n```go\nfunc (c *Client) UploadFile(ctx context.Context, filepath string) (*UpDownStatus, error)\n```\nUploads a given file to a CAS server\n\n```go\ntype ClientOpts func(u *Client)\n```\n\n```go\nfunc WithLogger(l zerolog.Logger) ClientOpts\n```\n\n```go\ntype Downloader interface {\n\tDownload(ctx context.Context, w io.Writer, digest string) error\n\t// Whether the CAS is ready to accept downloads\n\tIsReady(ctx context.Context) (bool, error)\n}\n```\n\n```go\ntype DownloaderUploader interface {\n\tDownloader\n\tUploader\n}\n```\n\n```go\ntype ProgressStatusChan chan (*UpDownStatus)\n```\n\n```go\ntype ResourceInfo struct {\n\tDigest   string\n\tFilename string\n\tSize     int64\n}\n```\n\n```go\ntype UpDownStatus struct {\n\tFilename, Digest string\n\tProcessedBytes   int64\n}\n```\n\n```go\ntype Uploader interface {\n\tUploadFile(ctx context.Context, filepath string) (*UpDownStatus, error)\n\tUpload(ctx context.Context, r io.Reader, filename, digest string) (*UpDownStatus, error)\n\t// Whether the CAS is ready to accept uploads\n\tIsReady(ctx context.Context) (bool, error)\n}\n```\n\n","path":"github.com/chainloop-dev/chainloop/pkg/casclient","name":"casclient","synopsis":"","isRedistributable":true}
