All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.instaclustr.cassandra.backup.impl.ManifestEntry Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha8
Show newest version
package com.instaclustr.cassandra.backup.impl;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import com.google.common.base.MoreObjects;

public class ManifestEntry {
    public enum Type {
        FILE,
        MANIFEST_FILE
    }

    public final Path objectKey, localFile;
    public final long size;
    public final Type type;

    public ManifestEntry(final Path objectKey,
                         final Path localFile,
                         final Type type) throws IOException {
        this.objectKey = objectKey;
        this.localFile = localFile;
        this.size = Files.size(localFile);
        this.type = type;
    }

    public ManifestEntry(final Path objectKey,
                         final Path localFile,
                         final Type type,
                         final long size) {
        this.objectKey = objectKey;
        this.localFile = localFile;
        this.size = size;
        this.type = type;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("objectKey", objectKey.toAbsolutePath())
                .add("localFile", localFile.toAbsolutePath().toString())
                .add("type", type)
                .add("size", size)
                .toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy