Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

wowselim/gimbap

Repository files navigation

gimbap Build Status

Disk-backed binary storage that supports all CRUD operations. Optional cloud extensions for aliyun-oss or s3 are available. All s3 compatible object stores should be supported with the latter.

Using gimbap

First, add gimbap to your dependencies using the jitpack repository.

For small objects

Store<byte[]> binaryStore = new BinaryStore();

String id = binaryStore.put("gimbap".getBytes());
byte[] data = binaryStore.get(id);

System.out.println(new String(data));
// prints gimbap

For large objects

StreamingStore<byte[]> binaryStore = new BinaryStore();

String id = binaryStore.putStream(
        new ByteArrayInputStream("gimbap".getBytes()));
byte[] data = binaryStore.get(id);

System.out.println(new String(data));
// prints gimbap

Using Alibaba Cloud Object Storage Service (streaming supported)

Add version 3.4.0 of the OSS SDK to your dependencies.

StreamingStore<byte[]> binaryStore = new OSSStore("endpoint",
        "bucketName",
        defaultCredentialProvider);

String id = binaryStore.put("gimbap".getBytes());
byte[] data = binaryStore.get(id);

System.out.println(new String(data));
// prints gimbap

Using the S3 SDK

Add version 1.X.X of the AWS SDK to your dependencies.

Store<byte[]> binaryStore = new S3Store(endpointConfiguration,
        awsStaticCredentialsProvider,
        "bucketName");