Documentation
¶
Index ¶
Constants ¶
const ( // BackupVersion is the current backup format version BackupVersion = "1.0.0" // BackupExtension is the file extension for backup files BackupExtension = ".weavebak" // CompressedExtension is the additional extension for compressed backups CompressedExtension = ".gz" )
Variables ¶
This section is empty.
Functions ¶
func WriteBackup ¶
func WriteBackup(backup *BackupFormat, outputPath string, compress bool) error
WriteBackup writes a backup to a file with optional compression
Types ¶
type BackupDocument ¶
type BackupDocument struct {
ID string `json:"id"`
Content string `json:"content,omitempty"`
Text string `json:"text,omitempty"`
Embedding []float64 `json:"embedding"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
// Image-specific fields
Image string `json:"image,omitempty"`
ImageData string `json:"image_data,omitempty"`
URL string `json:"url,omitempty"`
// External storage fields (v0.10.0+)
ImageThumbnail string `json:"image_thumbnail,omitempty"`
ImageURL string `json:"image_url,omitempty"`
ImageMetadata map[string]interface{} `json:"image_metadata,omitempty"`
}
BackupDocument represents a single document in the backup
type BackupFormat ¶
type BackupFormat struct {
Version string `json:"version"`
Metadata BackupMetadata `json:"metadata"`
Schema BackupSchema `json:"schema,omitempty"`
Documents []BackupDocument `json:"documents"`
}
BackupFormat represents the structure of a .weavebak backup file
func NewBackupFormat ¶
func NewBackupFormat(collection string, vdbType string, embeddingModel string, vectorDims int) *BackupFormat
NewBackupFormat creates a new backup format with current version and metadata
func ReadBackup ¶
func ReadBackup(inputPath string) (*BackupFormat, error)
ReadBackup reads a backup from a file (auto-detects compression)
type BackupInfo ¶
type BackupInfo struct {
FilePath string
FileName string
Collection string
VDBType string
TotalDocuments int
BackupSizeBytes int64
CreatedAt time.Time
WeaveVersion string
Compressed bool
}
BackupInfo holds information about a backup file
type BackupMetadata ¶
type BackupMetadata struct {
Collection string `json:"collection"`
VDBType string `json:"vdb_type"`
EmbeddingModel string `json:"embedding_model"`
VectorDimensions int `json:"vector_dimensions"`
CreatedAt time.Time `json:"created_at"`
WeaveVersion string `json:"weave_version"`
TotalDocuments int `json:"total_documents"`
BackupSizeBytes int64 `json:"backup_size_bytes"`
}
BackupMetadata contains metadata about the backup
type BackupSchema ¶
type BackupSchema struct {
VectorDimensions int `json:"vector_dimensions"`
SimilarityMetric string `json:"similarity_metric,omitempty"`
Fields []SchemaField `json:"fields,omitempty"`
}
BackupSchema contains the collection schema
type CreateOptions ¶
type CreateOptions struct {
Collection string
OutputFile string
VDBType string
Compress bool
BatchSize int
Quiet bool
}
CreateOptions holds options for backup creation
type RestoreOptions ¶
type RestoreOptions struct {
BackupFile string
Collection string // Optional: override collection name
VDBType string
Overwrite bool
Quiet bool
}
RestoreOptions holds options for backup restoration
type SchemaField ¶
SchemaField represents a field in the collection schema
type ValidationResult ¶
type ValidationResult struct {
Valid bool
Version string
Collection string
TotalDocuments int
BackupSizeBytes int64
Errors []string
Warnings []string
}
ValidationResult holds the result of backup validation
func ValidateBackup ¶
func ValidateBackup(inputPath string) (*ValidationResult, error)
ValidateBackup validates a backup file