Package io.crate.blob

Examples of io.crate.blob.StartBlobRequest


        byte[] contentBytes = content.getBytes();
        logger.trace("Uploading {} digest {}", content, digestString);
        BytesArray bytes = new BytesArray(new byte[]{contentBytes[0]});
        if (content.length() == 1) {
            client.execute(StartBlobAction.INSTANCE,
                    new StartBlobRequest(BlobIndices.fullIndexName("test"), digest, bytes,true))
                    .actionGet();
        } else {
            StartBlobRequest startBlobRequest = new StartBlobRequest(
                    BlobIndices.fullIndexName("test"), digest, bytes, false);
            client.execute(StartBlobAction.INSTANCE, startBlobRequest).actionGet();
            for (int i = 1; i < contentBytes.length; i++) {
                try {
                    Thread.sleep(timeBetweenChunks.get());
                } catch (InterruptedException ex) {
                    Thread.interrupted();
                }
                bytes = new BytesArray(new byte[]{contentBytes[i]});
                client.execute(PutChunkAction.INSTANCE,
                        new PutChunkRequest(
                                BlobIndices.fullIndexName("test"), digest,
                                startBlobRequest.transferId(), bytes, i,
                                (i + 1) == content.length())
                ).actionGet();
            }
        }
        logger.trace("Upload finished {} digest {}", content, digestString);
View Full Code Here

TOP

Related Classes of io.crate.blob.StartBlobRequest

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.