forked from Qortal/qortal
Log a comma separated list of hashes after splitting a file into chunks, so they can easily be requested from another node using the //data/files/frompeer/{peer} API endpoint. Again temporary until the sync happens automatically.
This commit is contained in:
parent
52829a244b
commit
ace5d999e2
@ -163,7 +163,8 @@ public class WebsiteResource {
|
||||
|
||||
int chunkCount = dataFile.split(DataFile.CHUNK_SIZE);
|
||||
if (chunkCount > 0) {
|
||||
LOGGER.info(String.format("Successfully split into %d chunk%s", chunkCount, (chunkCount == 1 ? "" : "s")));
|
||||
LOGGER.info(String.format("Successfully split into %d chunk%s:", chunkCount, (chunkCount == 1 ? "" : "s")));
|
||||
LOGGER.info("{}", dataFile.printChunks());
|
||||
return dataFile.base58Digest();
|
||||
}
|
||||
|
||||
|
@ -383,6 +383,19 @@ public class DataFile {
|
||||
return this.base58Digest().substring(0, Math.min(this.base58Digest().length(), SHORT_DIGEST_LENGTH));
|
||||
}
|
||||
|
||||
public String printChunks() {
|
||||
String outputString = "";
|
||||
if (this.chunkCount() > 0) {
|
||||
for (DataFileChunk chunk : this.chunks) {
|
||||
if (outputString.length() > 0) {
|
||||
outputString = outputString.concat(",");
|
||||
}
|
||||
outputString = outputString.concat(chunk.base58Digest());
|
||||
}
|
||||
}
|
||||
return outputString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.shortDigest();
|
||||
|
Loading…
x
Reference in New Issue
Block a user