github.com/weaviate/weaviate@v1.24.6/entities/modulecapabilities/backup.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package modulecapabilities
    13  
    14  import (
    15  	"context"
    16  	"io"
    17  )
    18  
    19  type BackupBackend interface {
    20  	// IsExternal returns whether the storage is an external storage (e.g. gcs, s3)
    21  	IsExternal() bool
    22  	// Name returns backend's name
    23  	Name() string
    24  	// HomeDir is the home directory of all backup files
    25  	HomeDir(backupID string) string
    26  
    27  	// GetObject giving backupID and key
    28  	GetObject(ctx context.Context, backupID, key string) ([]byte, error)
    29  
    30  	// WriteToFile writes an object in the specified file with path destPath
    31  	// The file will be created if it doesn't exist
    32  	// The file will be overwritten if it exists
    33  	WriteToFile(ctx context.Context, backupID, key, destPath string) error
    34  
    35  	// SourceDataPath is data path of all source files
    36  	SourceDataPath() string
    37  
    38  	// PutFile reads a file from srcPath and uploads it to the destination folder
    39  	PutFile(ctx context.Context, backupID, key, srcPath string) error
    40  	// PutObject writes bytes to the object with key `key`
    41  	PutObject(ctx context.Context, backupID, key string, byes []byte) error
    42  	// Initialize initializes backup provider and make sure that app have access rights to write into the object store.
    43  	Initialize(ctx context.Context, backupID string) error
    44  
    45  	Write(ctx context.Context, backupID, key string, r io.ReadCloser) (int64, error)
    46  	Read(ctx context.Context, backupID, key string, w io.WriteCloser) (int64, error)
    47  }