Package org.apache.solr.core.backup
Class ShardBackupMetadata
- java.lang.Object
-
- org.apache.solr.core.backup.ShardBackupMetadata
-
public class ShardBackupMetadata extends Object
Represents the shard-backup metadata file.The shard-backup metadata file is responsible for holding information about a specific backup-point for a specific shard. This includes the full list of index files required to restore this shard to the backup-point, with pointers to where each lives in the repository.
Shard backup metadata files have names derived from an associated
ShardBackupId
, to avoid conflicts between shards and backupIds.Not used by the (now deprecated) traditional 'full-snapshot' backup format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShardBackupMetadata.BackedFile
-
Constructor Summary
Constructors Constructor Description ShardBackupMetadata()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBackedFile(String uniqueFileName, String originalFileName, Checksum fileChecksum)
void
addBackedFile(ShardBackupMetadata.BackedFile backedFile)
static ShardBackupMetadata
empty()
static ShardBackupMetadata
from(BackupRepository repository, URI dir, ShardBackupId shardBackupId)
Reads a shard metadata file from aBackupRepository
and parses the result into aShardBackupMetadata
Optional<ShardBackupMetadata.BackedFile>
getFile(String originalFileName)
Collection<String>
listOriginalFileNames()
List<String>
listUniqueFileNames()
int
numFiles()
void
store(BackupRepository repository, URI folderURI, ShardBackupId shardBackupId)
Storing ShardBackupMetadata atfolderURI
with namefilename
.long
totalSize()
-
-
-
Method Detail
-
addBackedFile
public void addBackedFile(String uniqueFileName, String originalFileName, Checksum fileChecksum)
-
numFiles
public int numFiles()
-
totalSize
public long totalSize()
-
addBackedFile
public void addBackedFile(ShardBackupMetadata.BackedFile backedFile)
-
getFile
public Optional<ShardBackupMetadata.BackedFile> getFile(String originalFileName)
-
empty
public static ShardBackupMetadata empty()
-
from
public static ShardBackupMetadata from(BackupRepository repository, URI dir, ShardBackupId shardBackupId) throws IOException
Reads a shard metadata file from aBackupRepository
and parses the result into aShardBackupMetadata
- Parameters:
repository
- the storage repository to read shard-metadata fromdir
- URI for the 'shard_backup_metadata' directory of the backup to read fromshardBackupId
- the ID of the shard metadata file to read- Returns:
- a ShardBackupMetadata object representing the provided 'shardBackupId' if it could be found in 'dir', null otherwise
- Throws:
IOException
-
store
public void store(BackupRepository repository, URI folderURI, ShardBackupId shardBackupId) throws IOException
Storing ShardBackupMetadata atfolderURI
with namefilename
. If a file already existed there, overwrite it.- Throws:
IOException
-
listOriginalFileNames
public Collection<String> listOriginalFileNames()
-
-