github.com/weaviate/weaviate@v1.24.6/usecases/backup/sourcer.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 backup
    13  
    14  import (
    15  	"context"
    16  
    17  	"github.com/weaviate/weaviate/entities/backup"
    18  )
    19  
    20  // Sourcer represents the source of artifacts used in the backup
    21  type Sourcer interface { // implemented by the index
    22  	// ReleaseBackup signals to the underlying index that the files have been
    23  	// copied (or the operation aborted), and that it is safe for the index to
    24  	// change the files, such as start compactions.
    25  	ReleaseBackup(_ context.Context, id, class string) error
    26  
    27  	// Backupable returns whether all given class can be backed up.
    28  	Backupable(_ context.Context, classes []string) error
    29  
    30  	// BackupDescriptors returns a channel of class descriptors.
    31  	// Class descriptor records everything needed to restore a class
    32  	// If an error happens a descriptor with an error will be written to the channel just before closing it.
    33  	//
    34  	// BackupDescriptors acquires resources so that a call to ReleaseBackup() is mandatory to free acquired resources.
    35  	BackupDescriptors(_ context.Context, bakid string, classes []string,
    36  	) <-chan backup.ClassDescriptor
    37  
    38  	// ClassExists checks whether a class exits or not
    39  	ClassExists(name string) bool
    40  
    41  	// ListBackupable returns a list of all classes which can be backed up.
    42  	//
    43  	// A class cannot be backed up either if it doesn't exist or if it has more than one physical shard.
    44  	ListBackupable() []string
    45  }