Package com.sleepycat.je.rep.impl.networkRestore.Protocol

Examples of com.sleepycat.je.rep.impl.networkRestore.Protocol.FileInfoResp


        if (!file.exists()) {
            return false;
        }
        protocol.write(protocol.new
                       FileInfoReq(file.getName(), getSHA1), channel);
        FileInfoResp statResp =
            protocol.read(channel, Protocol.FileInfoResp.class);
        long fileLength = file.length();
        if (statResp.getFileLength() != fileLength) {
            return false;
        }
        if (statResp.getDigestSHA1().length == 0) {
            assert(!getSHA1);
            return haveFile(file, true); // request SHA1 this time around
        }
        byte digest[] =
            LogFileFeeder.getSHA1Digest(file, file.length()).digest();
        return Arrays.equals(digest, statResp.getDigestSHA1());
    }
View Full Code Here


                }
                /* Freeze the length and last modified date. */
                final long length = file.length();
                final long lastModified = file.lastModified();
                byte digest[] = null;
                FileInfoResp resp = null;
                Protocol.FileInfoResp cachedResp =
                    feederManager.statResponses.get(fileName);
                byte cachedDigest[] =
                    ((cachedResp != null) &&
                     (cachedResp.getFileLength() == length) &&
                     (cachedResp.getLastModifiedTime() == lastModified)) ?
                    cachedResp.getDigestSHA1() : null;

                if (fileReq instanceof FileInfoReq) {
                    if  (cachedDigest != null) {
                        digest = cachedDigest;
                    } else if (((FileInfoReq) fileReq).getNeedSHA1()) {
                        digest = getSHA1Digest(file, length).digest();
                    } else {
                        // Digest not requested
                        digest = new byte[0];
                    }
                    resp = protocol.new FileInfoResp
                        (fileName, length, lastModified, digest);
                } else {
                    protocol.write(protocol.new FileStart
                                   (fileName, length, lastModified),
                                   namedChannel);
View Full Code Here

                }
                /* Freeze the length and last modified date. */
                final long length = file.length();
                final long lastModified = file.lastModified();
                byte digest[] = null;
                FileInfoResp resp = null;
                Protocol.FileInfoResp cachedResp =
                    feederManager.statResponses.get(fileName);
                byte cachedDigest[] =
                    ((cachedResp != null) &&
                     (cachedResp.getFileLength() == length) &&
                     (cachedResp.getLastModifiedTime() == lastModified)) ?
                    cachedResp.getDigestSHA1() : null;

                if (fileReq instanceof FileInfoReq) {
                    if  (cachedDigest != null) {
                        digest = cachedDigest;
                    } else if (((FileInfoReq) fileReq).getNeedSHA1()) {
                        digest = getSHA1Digest(file, length).digest();
                    } else {
                        // Digest not requested
                        digest = new byte[0];
                    }
                    resp = protocol.new FileInfoResp
                        (fileName, length, lastModified, digest);
                } else {
                    protocol.write(protocol.new FileStart
                                   (fileName, length, lastModified), namedChannel);
                    digest = sendFileContents(file, length);
View Full Code Here

        if (!file.exists()) {
            return false;
        }
        protocol.write(protocol.new
                       FileInfoReq(file.getName(), getSHA1), channel);
        FileInfoResp statResp =
            protocol.read(channel, Protocol.FileInfoResp.class);
        long fileLength = file.length();
        if (statResp.getFileLength() != fileLength) {
            return false;
        }
        if (statResp.getDigestSHA1().length == 0) {
            assert(!getSHA1);
            return haveFile(file, true); // request SHA1 this time around
        }
        byte digest[] =
            LogFileFeeder.getSHA1Digest(file, file.length()).digest();
        return Arrays.equals(digest, statResp.getDigestSHA1());
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.rep.impl.networkRestore.Protocol.FileInfoResp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.