JCLOUDS-1452: Replace size with contentLength

Tracking B2 v2 API changes.
This commit is contained in:
Andrew Gaul 2018-09-28 12:04:42 -07:00
parent ce163f3498
commit 750809f97f
4 changed files with 15 additions and 11 deletions

View File

@ -205,9 +205,9 @@ public final class B2BlobStore extends BaseBlobStore {
} else {
Map<String, String> userMetadata = ImmutableMap.of();
ContentMetadata metadata = ContentMetadataBuilder.create()
.contentLength(entry.size())
.contentLength(entry.contentLength())
.build();
builder.add(new BlobMetadataImpl(null, entry.fileName(), null, null, null, null, entry.uploadTimestamp(), userMetadata, null, container, metadata, entry.size()));
builder.add(new BlobMetadataImpl(null, entry.fileName(), null, null, null, null, entry.uploadTimestamp(), userMetadata, null, container, metadata, entry.contentLength()));
}
}
return new PageSetImpl<StorageMetadata>(builder.build(), list.nextFileName());

View File

@ -41,12 +41,16 @@ public abstract class B2ObjectList {
public abstract Action action();
@Nullable public abstract String fileId();
public abstract String fileName();
public abstract long size();
public abstract long contentLength();
@Deprecated
public long size() {
return contentLength();
}
public abstract Date uploadTimestamp();
@SerializedNames({"action", "fileId", "fileName", "size", "uploadTimestamp"})
public static Entry create(Action action, @Nullable String fileId, String fileName, long size, long uploadTimestamp) {
return new AutoValue_B2ObjectList_Entry(action, fileId, fileName, size, new Date(uploadTimestamp));
@SerializedNames({"action", "fileId", "fileName", "contentLength", "uploadTimestamp"})
public static Entry create(Action action, @Nullable String fileId, String fileName, long contentLength, long uploadTimestamp) {
return new AutoValue_B2ObjectList_Entry(action, fileId, fileName, contentLength, new Date(uploadTimestamp));
}
}
}

View File

@ -4,14 +4,14 @@
"action": "upload",
"fileId": "4_z27c88f1d182b150646ff0b16_f1004ba650fe24e6b_d20150809_m012853_c100_v0009990_t0000",
"fileName": "files/hello.txt",
"size": 6,
"contentLength": 6,
"uploadTimestamp": 1439083733000
},
{
"action": "upload",
"fileId": "4_z27c88f1d182b150646ff0b16_f1004ba650fe24e6c_d20150809_m012854_c100_v0009990_t0000",
"fileName": "files/world.txt",
"size": 6,
"contentLength": 6,
"uploadTimestamp": 1439083734000
}
],

View File

@ -4,21 +4,21 @@
"action": "upload",
"fileId": "4_z27c88f1d182b150646ff0b16_f100920ddab886245_d20150809_m232316_c100_v0009990_t0003",
"fileName": "files/hello.txt",
"size": 6,
"contentLength": 6,
"uploadTimestamp": 1439162596000
},
{
"action": "hide",
"fileId": "4_z27c88f1d182b150646ff0b16_f100920ddab886247_d20150809_m232323_c100_v0009990_t0005",
"fileName": "files/world.txt",
"size": 0,
"contentLength": 0,
"uploadTimestamp": 1439162603000
},
{
"action": "upload",
"fileId": "4_z27c88f1d182b150646ff0b16_f100920ddab886246_d20150809_m232316_c100_v0009990_t0003",
"fileName": "files/world.txt",
"size": 6,
"contentLength": 6,
"uploadTimestamp": 1439162596000
}
],