Class Repository
java.lang.Object
repository.Repository
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionStores the unencrypted hash as the key and a pair of CID and Size as the valueA list to store the snapshots -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanexists(IPFSClusterConnector connector, String repoName) Returns a boolean whether the repository exists or not.static Repository.RepositoryGetget(Repository.GetData getData) Gets the repository meta file and converts it to an instance of the Repository classgetSize(int index) Gets the size of the snapshot with the specified indexprune(int amountToKeep) Based on the amount to keep returns the CIDs that are unique to the snapshots with an index higher or equal to amountToKeepstatic voidput(Repository.PutData commandData) Converts the repository file to utf 8 bytes and uploads it as a whole to ipfs.
-
Field Details
-
chunkingData
-
files
-
snapshots
-
-
Constructor Details
-
Repository
-
-
Method Details
-
exists
public static boolean exists(IPFSClusterConnector connector, String repoName) throws IOException, IPFSException Returns a boolean whether the repository exists or not. Assumes that the key of the repository has been correctly removed if the repository itself was removed- Parameters:
connector- the ipfs connector- Returns:
- whether a repo exists or not
- Throws:
IOExceptionIPFSException
-
get
public static Repository.RepositoryGet get(Repository.GetData getData) throws IOException, EncryptionException, IPFSException Gets the repository meta file and converts it to an instance of the Repository class- Returns:
- the extracted repository class
- Throws:
IOExceptionEncryptionExceptionIPFSException
-
put
public static void put(Repository.PutData commandData) throws EncryptionException, IOException, IPFSException Converts the repository file to utf 8 bytes and uploads it as a whole to ipfs. If the add was successful, the ipns name gets updated to the new file.- Parameters:
commandData- Helper record containing references to important objects- Throws:
EncryptionExceptionIOExceptionIPFSException
-
getSize
Gets the size of the snapshot with the specified index- Parameters:
index- The index of the snapshot- Returns:
- The size of the snapshot in bytes
-
prune
Based on the amount to keep returns the CIDs that are unique to the snapshots with an index higher or equal to amountToKeep- Parameters:
amountToKeep- The amount of snapshots to keep- Returns:
- The CIDs that should be removed/unpinned
-