model

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalLifecycleRules

func MarshalLifecycleRules(rules []LifecycleRule) json.RawMessage

MarshalJSON is a helper for LifecycleRule slices.

Types

type Bucket

type Bucket struct {
	grove.BaseModel `grove:"table:trove_buckets"`

	ID           string            `grove:"id,pk"              json:"id"               bson:"_id"`
	Name         string            `grove:"name,unique"        json:"name"             bson:"name"`
	Driver       string            `grove:"driver"             json:"driver"           bson:"driver"`
	Region       string            `grove:"region"             json:"region,omitempty" bson:"region,omitempty"`
	Versioning   bool              `grove:"versioning"         json:"versioning"       bson:"versioning"`
	CASEnabled   bool              `grove:"cas_enabled"        json:"cas_enabled"      bson:"cas_enabled"`
	Lifecycle    json.RawMessage   `grove:"lifecycle,type:jsonb" json:"lifecycle,omitempty" bson:"lifecycle,omitempty"`
	QuotaBytes   int64             `grove:"quota_bytes"        json:"quota_bytes"      bson:"quota_bytes"`
	QuotaObjects int64             `grove:"quota_objects"      json:"quota_objects"    bson:"quota_objects"`
	DefaultMeta  map[string]string `grove:"default_meta,type:jsonb" json:"default_meta,omitempty" bson:"default_meta,omitempty"`
	TenantKey    string            `grove:"tenant_key"         json:"tenant_key,omitempty" bson:"tenant_key,omitempty"`
	CreatedAt    time.Time         `grove:"created_at"         json:"created_at"       bson:"created_at"`
	UpdatedAt    time.Time         `grove:"updated_at"         json:"updated_at"       bson:"updated_at"`
}

Bucket represents a storage bucket with metadata.

type CASEntry

type CASEntry struct {
	grove.BaseModel `grove:"table:trove_cas_index"`

	Hash      string    `grove:"hash,pk"   json:"hash"      bson:"_id"`
	BucketID  string    `grove:"bucket_id" json:"bucket_id"  bson:"bucket_id"`
	Key       string    `grove:"key"       json:"key"        bson:"key"`
	Size      int64     `grove:"size"      json:"size"       bson:"size"`
	RefCount  int       `grove:"ref_count" json:"ref_count"   bson:"ref_count"`
	Pinned    bool      `grove:"pinned"    json:"pinned"     bson:"pinned"`
	CreatedAt time.Time `grove:"created_at" json:"created_at" bson:"created_at"`
}

CASEntry represents a CAS index entry in the database.

type Checksum

type Checksum struct {
	Algorithm string `json:"algorithm"`
	Value     string `json:"value"`
}

Checksum holds integrity verification data.

type ChunkInfo

type ChunkInfo struct {
	Number    int       `json:"number"`
	Size      int64     `json:"size"`
	ETag      string    `json:"etag,omitempty"`
	Uploaded  bool      `json:"uploaded"`
	Timestamp time.Time `json:"timestamp,omitempty"`
}

ChunkInfo tracks a single chunk in a multipart upload.

type LifecycleRule

type LifecycleRule struct {
	ID                  string `json:"id"`
	Prefix              string `json:"prefix,omitempty"`
	ExpirationDays      int    `json:"expiration_days,omitempty"`
	TransitionDays      int    `json:"transition_days,omitempty"`
	TransitionClass     string `json:"transition_class,omitempty"`
	NoncurrentDays      int    `json:"noncurrent_days,omitempty"`
	AbortIncompleteDays int    `json:"abort_incomplete_days,omitempty"`
}

LifecycleRule defines an automatic lifecycle transition or expiration.

func UnmarshalLifecycleRules

func UnmarshalLifecycleRules(data json.RawMessage) []LifecycleRule

UnmarshalLifecycleRules parses lifecycle rules from JSON.

type Object

type Object struct {
	grove.BaseModel `grove:"table:trove_objects"`

	ID           string            `grove:"id,pk"              json:"id"                bson:"_id"`
	BucketID     string            `grove:"bucket_id"          json:"bucket_id"         bson:"bucket_id"`
	Key          string            `grove:"key"                json:"key"               bson:"key"`
	Size         int64             `grove:"size"               json:"size"              bson:"size"`
	ContentType  string            `grove:"content_type"       json:"content_type"      bson:"content_type"`
	ETag         string            `grove:"etag"               json:"etag"              bson:"etag"`
	ChecksumAlg  string            `grove:"checksum_alg"       json:"checksum_alg,omitempty"  bson:"checksum_alg,omitempty"`
	ChecksumVal  string            `grove:"checksum_val"       json:"checksum_val,omitempty"  bson:"checksum_val,omitempty"`
	Metadata     map[string]string `grove:"metadata,type:jsonb" json:"metadata,omitempty" bson:"metadata,omitempty"`
	Tags         map[string]string `grove:"tags,type:jsonb"    json:"tags,omitempty"    bson:"tags,omitempty"`
	Driver       string            `grove:"driver"             json:"driver"            bson:"driver"`
	StorageClass string            `grove:"storage_class"      json:"storage_class,omitempty" bson:"storage_class,omitempty"`
	VersionID    string            `grove:"version_id"         json:"version_id,omitempty" bson:"version_id,omitempty"`
	TenantKey    string            `grove:"tenant_key"         json:"tenant_key,omitempty" bson:"tenant_key,omitempty"`
	DeletedAt    *time.Time        `grove:"deleted_at"         json:"deleted_at,omitempty" bson:"deleted_at,omitempty"`
	CreatedAt    time.Time         `grove:"created_at"         json:"created_at"        bson:"created_at"`
	UpdatedAt    time.Time         `grove:"updated_at"         json:"updated_at"        bson:"updated_at"`
}

Object represents a stored object with metadata.

type Quota

type Quota struct {
	grove.BaseModel `grove:"table:trove_quotas"`

	TenantKey    string    `grove:"tenant_key,pk"  json:"tenant_key"    bson:"_id"`
	UsedBytes    int64     `grove:"used_bytes"     json:"used_bytes"    bson:"used_bytes"`
	LimitBytes   int64     `grove:"limit_bytes"    json:"limit_bytes"   bson:"limit_bytes"`
	ObjectCount  int64     `grove:"object_count"   json:"object_count"  bson:"object_count"`
	LimitObjects int64     `grove:"limit_objects"  json:"limit_objects" bson:"limit_objects"`
	UpdatedAt    time.Time `grove:"updated_at"  json:"updated_at"    bson:"updated_at"`
}

Quota tracks storage usage per tenant.

type UploadSession

type UploadSession struct {
	grove.BaseModel `grove:"table:trove_upload_sessions"`

	ID            string            `grove:"id,pk"              json:"id"               bson:"_id"`
	BucketID      string            `grove:"bucket_id"          json:"bucket_id"        bson:"bucket_id"`
	ObjectKey     string            `grove:"object_key"         json:"object_key"       bson:"object_key"`
	ContentType   string            `grove:"content_type"       json:"content_type"     bson:"content_type"`
	Status        UploadStatus      `grove:"status"             json:"status"           bson:"status"`
	TotalParts    int               `grove:"total_parts"        json:"total_parts"      bson:"total_parts"`
	UploadedParts int               `grove:"uploaded_parts"     json:"uploaded_parts"   bson:"uploaded_parts"`
	TotalSize     int64             `grove:"total_size"         json:"total_size"       bson:"total_size"`
	Chunks        json.RawMessage   `grove:"chunks,type:jsonb"  json:"chunks,omitempty" bson:"chunks,omitempty"`
	Metadata      map[string]string `grove:"metadata,type:jsonb" json:"metadata,omitempty" bson:"metadata,omitempty"`
	TenantKey     string            `grove:"tenant_key"         json:"tenant_key,omitempty" bson:"tenant_key,omitempty"`
	ExpiresAt     time.Time         `grove:"expires_at"         json:"expires_at"       bson:"expires_at"`
	CreatedAt     time.Time         `grove:"created_at"         json:"created_at"       bson:"created_at"`
	UpdatedAt     time.Time         `grove:"updated_at"         json:"updated_at"       bson:"updated_at"`
}

UploadSession represents a multipart upload session.

type UploadStatus

type UploadStatus string

UploadStatus represents the state of a multipart upload session.

const (
	UploadStatusPending   UploadStatus = "pending"
	UploadStatusActive    UploadStatus = "active"
	UploadStatusCompleted UploadStatus = "completed"
	UploadStatusAborted   UploadStatus = "aborted"
	UploadStatusExpired   UploadStatus = "expired"
)

Jump to

Keyboard shortcuts

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