Skip to content

Repository files navigation

ReductStore Client SDK for Java

This package provides a Java client for interacting with the ReductStore service.

Requirements

  • Java 17 or higher

Getting Started

To get started with the ReductStore Client SDK for Java, you'll need to have ReductStore installed and running on your machine. You can find instructions for installing ReductStore here.

Create a new access token

NOTE: The token you're instantiating the client with must have full access to create new tokens.

importstore.reduct.client.ReductTokenClient;
importstore.reduct.client.TokenClient;
importstore.reduct.client.config.ServerProperties;
importstore.reduct.model.token.AccessToken;
importstore.reduct.model.token.TokenPermissions;
importjava.util.List;
publicclassMain {
publicstaticvoidmain(String[] args) {
ServerPropertiesserverProperties = newServerProperties(false, "127.0.0.1", 8383);
TokenClienttokenClient = newReductTokenClient(serverProperties, "<your_api_key>");
TokenPermissionstokenPermissions =
TokenPermissions.of(true, List.of("test"), List.of("test"));
AccessTokentoken = tokenClient.createToken("a_token_name", tokenPermissions);
System.out.println("Token: " + token.value());
System.out.println("Created at: " + token.createdAt());
}
}

Retrieve information about the server

importstore.reduct.client.ReductServerClient;
importstore.reduct.client.config.ServerProperties;
importstore.reduct.model.server.ServerInfo;
publicclassMain {
publicstaticvoidmain(String[] args) {
ServerPropertiesserverProperties = newServerProperties(false, "127.0.0.1", 8383);
ServerClientclient = newReductServerClient(serverProperties, "<your-api-key>");
ServerInfoserverInfo = client.getServerInfo();
System.out.println("Version: " + serverInfo.getVersion());
System.out.println("Bucket Count: " + serverInfo.getBucketsCount());
}
}

Create a new bucket

importstore.reduct.client.BucketClient;
importstore.reduct.client.ReductBucketClient;
importstore.reduct.client.config.ServerProperties;
importstore.reduct.model.bucket.BucketSettings;
importstore.reduct.model.bucket.QuotaType;
publicclassMain {
publicstaticvoidmain(String[] args) {
ServerPropertiesserverProperties = newServerProperties(false, "127.0.0.1", 8383);
BucketClientbucketClient = newReductBucketClient(serverProperties, "<your-api-key>");
BucketSettingssettings = BucketSettings.builder()
.quotaType(QuotaType.NONE)
.maxBlockSize(64000)
.build();
Stringbucket = bucketClient.createBucket("test-bucket", settings);
System.out.println(bucket);
}
}

References

About

Reduct Storage Client SDK for Java

Resources

Code of conduct

Stars

5 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages