| Blob gives the size of a blob but not when it was last written. A feature that keeps short-lived blobs (for example uploads that expire after some hours) has to put the time in the blob path or in a companion blob, and its expiry then depends on the clock of the cluster member that wrote it. Both stores have the information: S3 returns LastModified in HeadObject and ListObjectsV2, and the file system keeps a modification time. Proposal: Blob#getLastModified() returning an Instant (null when the blob does not exist, as getSize() returns -1). S3: getHeadObject().lastModified(); file system: Files.getLastModifiedTime(path). The time is set by the store (S3 server time, second precision; the file system's mtime), so it is not meant to order two writes made within the same second. Tests in AbstractBlobStoreIT so that both stores are covered. Finding from a Kubernetes test cluster where temporary attachments are kept in a shared blob store. |