Files
zeekay 1f46b19460 feat(cloud): gate GCS + GCP behind -tags gcs (grpc opt-in only)
cloud.google.com/go/storage + google.golang.org/api/compute/v1 pull
grpc + s2a-go + cloud.google.com/go/iam + the Google Cloud SDK
transitive chain. grpc is opt-in only on this stack; GCS/GCP follow
the same discipline: enable with -tags gcs.

Default build pulls 0 grpc. -tags gcs flips on the real GCS storage
backend (with disabled stub returning errGCSDisabled) and the GCP VM
deployment package (currently unreferenced — orphan code).
2026-05-21 17:34:34 -07:00

67 lines
2.6 KiB
Go

//go:build !gcs
// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Default-build stub for the GCS storage backend. cloud.google.com/go/storage
// pulls google.golang.org/grpc + s2a-go + cloud.google.com/go/iam + the
// full Google Cloud SDK transitive chain. grpc is opt-in only across the
// Lux/Hanzo stack, so GCS follows the same discipline: enable with
// `-tags gcs`. Without the tag, NewGCSStorage returns errGCSDisabled and
// the dispatch in storage.go returns the operator a clear error pointing
// them at s3:// (hanzoai/s3, MinIO-protocol).
package storage
import (
"context"
"errors"
"io"
"time"
)
var errGCSDisabled = errors.New(
"cli/storage: gcs provider not compiled (build with `-tags gcs` to enable Google Cloud Storage; default builds use s3 via hanzoai/s3)",
)
// GCSStorage is the disabled-build type. NewGCSStorage always returns
// errGCSDisabled so the methods are never invoked; they only need to
// exist so the Storage interface is satisfied at type-check time.
type GCSStorage struct{}
func NewGCSStorage(_ context.Context, _ *Config) (*GCSStorage, error) {
return nil, errGCSDisabled
}
func (*GCSStorage) Upload(_ context.Context, _ string, _ io.Reader, _ int64, _ *UploadOptions) error {
return errGCSDisabled
}
func (*GCSStorage) UploadFile(_ context.Context, _ string, _ string, _ *UploadOptions) error {
return errGCSDisabled
}
func (*GCSStorage) Download(_ context.Context, _ string, _ io.Writer, _ *DownloadOptions) error {
return errGCSDisabled
}
func (*GCSStorage) DownloadFile(_ context.Context, _ string, _ string, _ *DownloadOptions) error {
return errGCSDisabled
}
func (*GCSStorage) Delete(_ context.Context, _ string) error { return errGCSDisabled }
func (*GCSStorage) DeleteMany(_ context.Context, _ []string) error {
return errGCSDisabled
}
func (*GCSStorage) Exists(_ context.Context, _ string) (bool, error) {
return false, errGCSDisabled
}
func (*GCSStorage) GetInfo(_ context.Context, _ string) (*ObjectInfo, error) {
return nil, errGCSDisabled
}
func (*GCSStorage) List(_ context.Context, _ *ListOptions) (*ListResult, error) {
return nil, errGCSDisabled
}
func (*GCSStorage) GetSignedURL(_ context.Context, _ string, _ time.Duration, _ bool) (string, error) {
return "", errGCSDisabled
}
func (*GCSStorage) Copy(_ context.Context, _, _ string) error { return errGCSDisabled }
func (*GCSStorage) Provider() Provider { return ProviderGCS }
func (*GCSStorage) Bucket() string { return "" }
func (*GCSStorage) Close() error { return nil }