[#1] provide naming conventions

Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
Ori Bruk 2024-07-23 22:24:17 +03:00
parent a7fab6f314
commit bf2f19f08d
103 changed files with 416 additions and 417 deletions

View file

@ -21,12 +21,12 @@ neo-go wallet export -w <path_to_your_wallet> -d <address_from_p1>
### Container
```java
import info.FrostFS.sdk.dto.container.Container;
import info.FrostFS.sdk.dto.netmap.PlacementPolicy;
import info.FrostFS.sdk.dto.netmap.Replica;
import info.FrostFS.sdk.enums.BasicAcl;
import info.FrostFS.sdk.jdo.ClientSettings;
import info.FrostFS.sdk.services.FrostFSClient;
import info.frostfs.sdk.dto.container.Container;
import info.frostfs.sdk.dto.netmap.PlacementPolicy;
import info.frostfs.sdk.dto.netmap.Replica;
import info.frostfs.sdk.enums.BasicAcl;
import info.frostfs.sdk.jdo.ClientSettings;
import info.frostfs.sdk.services.FrostFSClient;
public class ContainerExample {
@ -53,13 +53,13 @@ public class ContainerExample {
### Object
```java
import info.FrostFS.sdk.enums.ObjectType;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.dto.object.ObjectAttribute;
import info.FrostFS.sdk.dto.object.ObjectFilter;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.jdo.PutObjectParameters;
import info.FrostFS.sdk.services.FrostFSClient;
import info.frostfs.sdk.enums.ObjectType;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.object.ObjectAttribute;
import info.frostfs.sdk.dto.object.ObjectFilter;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.jdo.PutObjectParameters;
import info.frostfs.sdk.services.FrostFSClient;
import java.io.FileInputStream;
import java.io.IOException;
@ -71,7 +71,7 @@ public class ObjectExample {
FrostFSClient frostFSClient = new FrostFSClient(clientSettings);
// Put object
info.FrostFS.sdk.dto.object.ObjectId objectId;
info.frostfs.sdk.dto.object.ObjectId objectId;
try (FileInputStream fis = new FileInputStream("cat.jpg")) {
var cat = new ObjectHeader(
containerId, ObjectType.REGULAR, new ObjectAttribute[]{new ObjectAttribute("Filename", "cat.jpg")}

View file

@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>info.FrostFS.sdk</groupId>
<artifactId>FrostFS-sdk-java</artifactId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>frostfs-sdk-java</artifactId>
<version>0.1.0</version>
</parent>
@ -19,12 +19,12 @@
<dependencies>
<dependency>
<groupId>info.FrostFS.sdk</groupId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>cryptography</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>info.FrostFS.sdk</groupId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>models</artifactId>
<version>0.1.0</version>
</dependency>

View file

@ -1,13 +0,0 @@
package info.FrostFS.sdk.services;
import info.FrostFS.sdk.dto.netmap.NetmapSnapshot;
import info.FrostFS.sdk.dto.netmap.NodeInfo;
import info.FrostFS.sdk.jdo.NetworkSettings;
public interface NetmapClient {
NetmapSnapshot getNetmapSnapshot();
NodeInfo getLocalNodeInfo();
NetworkSettings getNetworkSettings();
}

View file

@ -1,8 +0,0 @@
package info.FrostFS.sdk.services;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.dto.object.ObjectId;
public interface ToolsClient {
ObjectId calculateObjectId(ObjectHeader header);
}

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.constants;
package info.frostfs.sdk.constants;
public class CryptoConst {
public static final String SIGNATURE_ALGORITHM = "NONEwithECDSAinP1363Format";

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.jdo;
package info.frostfs.sdk.jdo;
import info.FrostFS.sdk.dto.OwnerId;
import info.FrostFS.sdk.dto.Version;
import info.FrostFS.sdk.services.FrostFSClient;
import info.frostfs.sdk.dto.OwnerId;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.services.FrostFSClient;
import io.grpc.Channel;
public class ClientEnvironment {

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.jdo;
package info.frostfs.sdk.jdo;
import io.grpc.ChannelCredentials;
import org.apache.commons.lang3.StringUtils;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.jdo;
package info.frostfs.sdk.jdo;
import java.security.PrivateKey;
import static info.FrostFS.sdk.KeyExtension.*;
import static info.frostfs.sdk.KeyExtension.*;
public class ECDsa {
private final byte[] publicKeyByte;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.jdo;
package info.frostfs.sdk.jdo;
import java.util.HashMap;
import java.util.Map;

View file

@ -1,6 +1,6 @@
package info.FrostFS.sdk.jdo;
package info.frostfs.sdk.jdo;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.dto.object.ObjectHeader;
import java.io.FileInputStream;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.services;
package info.frostfs.sdk.services;
import info.FrostFS.sdk.dto.container.Container;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.container.Container;
import info.frostfs.sdk.dto.container.ContainerId;
import java.util.List;

View file

@ -1,6 +1,6 @@
package info.FrostFS.sdk.services;
package info.frostfs.sdk.services;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.jdo.ClientEnvironment;
public class ContextAccessor {
private final ClientEnvironment context;

View file

@ -1,26 +1,26 @@
package info.FrostFS.sdk.services;
package info.frostfs.sdk.services;
import frostFS.session.Types;
import info.FrostFS.sdk.dto.SessionToken;
import info.FrostFS.sdk.dto.Version;
import info.FrostFS.sdk.dto.container.Container;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.dto.netmap.NetmapSnapshot;
import info.FrostFS.sdk.dto.netmap.NodeInfo;
import info.FrostFS.sdk.dto.object.ObjectFilter;
import info.FrostFS.sdk.dto.object.ObjectFrostFS;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.dto.object.ObjectId;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.FrostFS.sdk.jdo.ClientSettings;
import info.FrostFS.sdk.jdo.NetworkSettings;
import info.FrostFS.sdk.jdo.PutObjectParameters;
import info.FrostFS.sdk.services.impl.*;
import frostfs.session.Types;
import info.frostfs.sdk.dto.SessionToken;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.dto.container.Container;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.netmap.NetmapSnapshot;
import info.frostfs.sdk.dto.netmap.NodeInfo;
import info.frostfs.sdk.dto.object.ObjectFilter;
import info.frostfs.sdk.dto.object.ObjectFrostFS;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.dto.object.ObjectId;
import info.frostfs.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.jdo.ClientSettings;
import info.frostfs.sdk.jdo.NetworkSettings;
import info.frostfs.sdk.jdo.PutObjectParameters;
import info.frostfs.sdk.services.impl.*;
import io.grpc.Channel;
import java.util.List;
import static info.FrostFS.sdk.tools.GrpcClient.initGrpcChannel;
import static info.frostfs.sdk.tools.GrpcClient.initGrpcChannel;
import static java.util.Objects.isNull;
public class FrostFSClient implements ContainerClient, ObjectClient, NetmapClient, SessionClient, ToolsClient {

View file

@ -0,0 +1,13 @@
package info.frostfs.sdk.services;
import info.frostfs.sdk.dto.netmap.NetmapSnapshot;
import info.frostfs.sdk.dto.netmap.NodeInfo;
import info.frostfs.sdk.jdo.NetworkSettings;
public interface NetmapClient {
NetmapSnapshot getNetmapSnapshot();
NodeInfo getLocalNodeInfo();
NetworkSettings getNetworkSettings();
}

View file

@ -1,11 +1,11 @@
package info.FrostFS.sdk.services;
package info.frostfs.sdk.services;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.dto.object.ObjectFilter;
import info.FrostFS.sdk.dto.object.ObjectFrostFS;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.dto.object.ObjectId;
import info.FrostFS.sdk.jdo.PutObjectParameters;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.object.ObjectFilter;
import info.frostfs.sdk.dto.object.ObjectFrostFS;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.dto.object.ObjectId;
import info.frostfs.sdk.jdo.PutObjectParameters;
public interface ObjectClient {
ObjectHeader getObjectHead(ContainerId containerId, ObjectId objectId);

View file

@ -1,6 +1,6 @@
package info.FrostFS.sdk.services;
package info.frostfs.sdk.services;
import info.FrostFS.sdk.dto.SessionToken;
import info.frostfs.sdk.dto.SessionToken;
public interface SessionClient {
SessionToken createSession(long expiration);

View file

@ -0,0 +1,8 @@
package info.frostfs.sdk.services;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.dto.object.ObjectId;
public interface ToolsClient {
ObjectId calculateObjectId(ObjectHeader header);
}

View file

@ -1,24 +1,25 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import frostFS.container.ContainerServiceGrpc;
import frostFS.container.Service;
import info.FrostFS.sdk.dto.container.Container;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.FrostFS.sdk.mappers.OwnerIdMapper;
import info.FrostFS.sdk.mappers.VersionMapper;
import info.FrostFS.sdk.mappers.container.ContainerIdMapper;
import info.FrostFS.sdk.mappers.container.ContainerMapper;
import info.FrostFS.sdk.services.ContainerClient;
import info.FrostFS.sdk.services.ContextAccessor;
import info.FrostFS.sdk.tools.Verifier;
import frostfs.container.ContainerServiceGrpc;
import frostfs.container.Service;
import info.frostfs.sdk.dto.container.Container;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.mappers.OwnerIdMapper;
import info.frostfs.sdk.mappers.VersionMapper;
import info.frostfs.sdk.mappers.container.ContainerIdMapper;
import info.frostfs.sdk.mappers.container.ContainerMapper;
import info.frostfs.sdk.services.ContainerClient;
import info.frostfs.sdk.services.ContextAccessor;
import info.frostfs.sdk.tools.Verifier;
import info.frostfs.sdk.tools.RequestConstructor;
import info.frostfs.sdk.tools.RequestSigner;
import java.util.List;
import java.util.stream.Collectors;
import static info.FrostFS.sdk.tools.RequestConstructor.addMetaHeader;
import static info.FrostFS.sdk.tools.RequestSigner.sign;
import static info.FrostFS.sdk.tools.RequestSigner.signRFC6979;
import static info.frostfs.sdk.tools.RequestConstructor.addMetaHeader;
import static info.frostfs.sdk.tools.RequestSigner.signRFC6979;
public class ContainerService extends ContextAccessor implements ContainerClient {
private final ContainerServiceGrpc.ContainerServiceBlockingStub serviceBlockingStub;
@ -36,8 +37,8 @@ public class ContainerService extends ContextAccessor implements ContainerClient
.build()
);
addMetaHeader(request);
sign(request, getContext().getKey());
RequestConstructor.addMetaHeader(request);
RequestSigner.sign(request, getContext().getKey());
var response = serviceBlockingStub.get(request.build());
@ -53,8 +54,8 @@ public class ContainerService extends ContextAccessor implements ContainerClient
.build()
);
addMetaHeader(request);
sign(request, getContext().getKey());
RequestConstructor.addMetaHeader(request);
RequestSigner.sign(request, getContext().getKey());
var response = serviceBlockingStub.list(request.build());
@ -78,13 +79,13 @@ public class ContainerService extends ContextAccessor implements ContainerClient
Service.PutRequest.Body.newBuilder()
.setContainer(grpcContainer)
.setSignature(
signRFC6979(getContext().getKey(), grpcContainer)
RequestSigner.signRFC6979(getContext().getKey(), grpcContainer)
)
.build()
);
addMetaHeader(request);
sign(request, getContext().getKey());
RequestConstructor.addMetaHeader(request);
RequestSigner.sign(request, getContext().getKey());
var response = serviceBlockingStub.put(request.build());
@ -99,14 +100,14 @@ public class ContainerService extends ContextAccessor implements ContainerClient
.setBody(
Service.DeleteRequest.Body.newBuilder()
.setContainerId(grpcContainerId)
.setSignature(signRFC6979(
.setSignature(RequestSigner.signRFC6979(
getContext().getKey(), grpcContainerId.getValue()
))
.build()
);
addMetaHeader(request);
sign(request, getContext().getKey());
RequestConstructor.addMetaHeader(request);
RequestSigner.sign(request, getContext().getKey());
var response = serviceBlockingStub.delete(request.build());

View file

@ -1,22 +1,22 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import frostFS.netmap.NetmapServiceGrpc;
import frostFS.netmap.Service;
import frostFS.netmap.Types;
import info.FrostFS.sdk.dto.netmap.NetmapSnapshot;
import info.FrostFS.sdk.dto.netmap.NodeInfo;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.FrostFS.sdk.jdo.NetworkSettings;
import info.FrostFS.sdk.mappers.netmap.NetmapSnapshotMapper;
import info.FrostFS.sdk.mappers.netmap.NodeInfoMapper;
import info.FrostFS.sdk.services.ContextAccessor;
import info.FrostFS.sdk.services.NetmapClient;
import info.FrostFS.sdk.tools.Verifier;
import frostfs.netmap.NetmapServiceGrpc;
import frostfs.netmap.Service;
import frostfs.netmap.Types;
import info.frostfs.sdk.dto.netmap.NetmapSnapshot;
import info.frostfs.sdk.dto.netmap.NodeInfo;
import info.frostfs.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.jdo.NetworkSettings;
import info.frostfs.sdk.mappers.netmap.NetmapSnapshotMapper;
import info.frostfs.sdk.mappers.netmap.NodeInfoMapper;
import info.frostfs.sdk.services.ContextAccessor;
import info.frostfs.sdk.services.NetmapClient;
import info.frostfs.sdk.tools.Verifier;
import java.nio.charset.StandardCharsets;
import static info.FrostFS.sdk.tools.RequestConstructor.addMetaHeader;
import static info.FrostFS.sdk.tools.RequestSigner.sign;
import static info.frostfs.sdk.tools.RequestConstructor.addMetaHeader;
import static info.frostfs.sdk.tools.RequestSigner.sign;
import static java.util.Objects.nonNull;
public class NetmapService extends ContextAccessor implements NetmapClient {

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import frostFS.object.Service;
import frostFS.object.Types;
import info.FrostFS.sdk.tools.Verifier;
import frostfs.object.Service;
import frostfs.object.Types;
import info.frostfs.sdk.tools.Verifier;
import java.util.Iterator;

View file

@ -1,26 +1,26 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import com.google.common.collect.Iterables;
import com.google.protobuf.ByteString;
import frostFS.object.ObjectServiceGrpc;
import frostFS.object.Service;
import frostFS.refs.Types;
import info.FrostFS.sdk.constants.AppConst;
import info.FrostFS.sdk.dto.Split;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.dto.object.*;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.FrostFS.sdk.jdo.PutObjectParameters;
import info.FrostFS.sdk.mappers.OwnerIdMapper;
import info.FrostFS.sdk.mappers.VersionMapper;
import info.FrostFS.sdk.mappers.container.ContainerIdMapper;
import info.FrostFS.sdk.mappers.object.ObjectFilterMapper;
import info.FrostFS.sdk.mappers.object.ObjectFrostFSMapper;
import info.FrostFS.sdk.mappers.object.ObjectHeaderMapper;
import info.FrostFS.sdk.mappers.object.ObjectIdMapper;
import info.FrostFS.sdk.services.ContextAccessor;
import info.FrostFS.sdk.services.ObjectClient;
import info.FrostFS.sdk.tools.Verifier;
import frostfs.object.ObjectServiceGrpc;
import frostfs.object.Service;
import frostfs.refs.Types;
import info.frostfs.sdk.constants.AppConst;
import info.frostfs.sdk.dto.Split;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.object.*;
import info.frostfs.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.jdo.PutObjectParameters;
import info.frostfs.sdk.mappers.OwnerIdMapper;
import info.frostfs.sdk.mappers.VersionMapper;
import info.frostfs.sdk.mappers.container.ContainerIdMapper;
import info.frostfs.sdk.mappers.object.ObjectFilterMapper;
import info.frostfs.sdk.mappers.object.ObjectFrostFSMapper;
import info.frostfs.sdk.mappers.object.ObjectHeaderMapper;
import info.frostfs.sdk.mappers.object.ObjectIdMapper;
import info.frostfs.sdk.services.ContextAccessor;
import info.frostfs.sdk.services.ObjectClient;
import info.frostfs.sdk.tools.Verifier;
import org.apache.commons.collections4.CollectionUtils;
import java.io.FileInputStream;
@ -29,10 +29,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static info.FrostFS.sdk.Helper.getSha256;
import static info.FrostFS.sdk.tools.RequestConstructor.addMetaHeader;
import static info.FrostFS.sdk.tools.RequestConstructor.addObjectSessionToken;
import static info.FrostFS.sdk.tools.RequestSigner.sign;
import static info.frostfs.sdk.Helper.getSha256;
import static info.frostfs.sdk.tools.RequestConstructor.addMetaHeader;
import static info.frostfs.sdk.tools.RequestConstructor.addObjectSessionToken;
import static info.frostfs.sdk.tools.RequestSigner.sign;
import static java.util.Objects.nonNull;
public class ObjectService extends ContextAccessor implements ObjectClient {
@ -90,7 +90,7 @@ public class ObjectService extends ContextAccessor implements ObjectClient {
addMetaHeader(request);
addObjectSessionToken(
request, sessionToken, ContainerIdMapper.toGrpcMessage(cid), ObjectIdMapper.toGrpcMessage(oid),
frostFS.session.Types.ObjectSessionContext.Verb.GET, getContext().getKey()
frostfs.session.Types.ObjectSessionContext.Verb.GET, getContext().getKey()
);
sign(request, getContext().getKey());
@ -159,7 +159,7 @@ public class ObjectService extends ContextAccessor implements ObjectClient {
addMetaHeader(request);
addObjectSessionToken(
request, sessionToken, grpcObject.getHeader().getContainerId(), grpcObject.getObjectId(),
frostFS.session.Types.ObjectSessionContext.Verb.PUT, getContext().getKey()
frostfs.session.Types.ObjectSessionContext.Verb.PUT, getContext().getKey()
);
sign(request, getContext().getKey());
@ -170,7 +170,7 @@ public class ObjectService extends ContextAccessor implements ObjectClient {
return ObjectId.fromHash(grpcObject.getObjectId().getValue().toByteArray());
}
private frostFS.object.Types.Object getObject(Service.GetRequest request) {
private frostfs.object.Types.Object getObject(Service.GetRequest request) {
var iterator = getObjectInit(request);
var obj = iterator.readHeader();
var payload = new byte[Math.toIntExact(obj.getHeader().getPayloadLength())];
@ -218,7 +218,7 @@ public class ObjectService extends ContextAccessor implements ObjectClient {
addMetaHeader(initRequest);
addObjectSessionToken(
initRequest, sessionToken, hdr.getContainerId(), oid,
frostFS.session.Types.ObjectSessionContext.Verb.PUT, getContext().getKey()
frostfs.session.Types.ObjectSessionContext.Verb.PUT, getContext().getKey()
);
sign(initRequest, getContext().getKey());

View file

@ -1,21 +1,21 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import com.google.protobuf.ByteString;
import frostFS.object.Types;
import info.FrostFS.sdk.dto.object.ObjectFrostFS;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.dto.object.ObjectId;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.FrostFS.sdk.mappers.OwnerIdMapper;
import info.FrostFS.sdk.mappers.VersionMapper;
import info.FrostFS.sdk.mappers.object.ObjectHeaderMapper;
import info.FrostFS.sdk.mappers.object.ObjectIdMapper;
import info.FrostFS.sdk.services.ContextAccessor;
import info.FrostFS.sdk.services.ToolsClient;
import frostfs.object.Types;
import info.frostfs.sdk.dto.object.ObjectFrostFS;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.dto.object.ObjectId;
import info.frostfs.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.mappers.OwnerIdMapper;
import info.frostfs.sdk.mappers.VersionMapper;
import info.frostfs.sdk.mappers.object.ObjectHeaderMapper;
import info.frostfs.sdk.mappers.object.ObjectIdMapper;
import info.frostfs.sdk.services.ContextAccessor;
import info.frostfs.sdk.services.ToolsClient;
import org.apache.commons.collections4.ListUtils;
import static info.FrostFS.sdk.Helper.getSha256;
import static info.FrostFS.sdk.tools.RequestSigner.signData;
import static info.frostfs.sdk.Helper.getSha256;
import static info.frostfs.sdk.tools.RequestSigner.signData;
import static java.util.Objects.nonNull;
public class ObjectTools extends ContextAccessor implements ToolsClient {
@ -23,9 +23,9 @@ public class ObjectTools extends ContextAccessor implements ToolsClient {
super(context);
}
private static frostFS.refs.Types.Checksum sha256Checksum(byte[] data) {
return frostFS.refs.Types.Checksum.newBuilder()
.setType(frostFS.refs.Types.ChecksumType.SHA256)
private static frostfs.refs.Types.Checksum sha256Checksum(byte[] data) {
return frostfs.refs.Types.Checksum.newBuilder()
.setType(frostfs.refs.Types.ChecksumType.SHA256)
.setSum(ByteString.copyFrom(getSha256(data)))
.build();
}
@ -35,7 +35,7 @@ public class ObjectTools extends ContextAccessor implements ToolsClient {
var grpcHeader = createHeader(header, new byte[]{});
return ObjectIdMapper.toModel(
frostFS.refs.Types.ObjectID.newBuilder().setValue(getSha256(grpcHeader)).build()
frostfs.refs.Types.ObjectID.newBuilder().setValue(getSha256(grpcHeader)).build()
);
}
@ -58,13 +58,13 @@ public class ObjectTools extends ContextAccessor implements ToolsClient {
if (nonNull(split.getParentHeader())) {
var grpcParentHeader = createHeader(split.getParentHeader(), new byte[]{});
var parent = frostFS.refs.Types.ObjectID.newBuilder().setValue(getSha256(grpcParentHeader)).build();
var parent = frostfs.refs.Types.ObjectID.newBuilder().setValue(getSha256(grpcParentHeader)).build();
splitGrpc
.setParent(parent)
.setParentHeader(grpcParentHeader)
.setParentSignature(
frostFS.refs.Types.Signature.newBuilder()
frostfs.refs.Types.Signature.newBuilder()
.setKey(ByteString.copyFrom(getContext().getKey().getPublicKeyByte()))
.setSign(ByteString.copyFrom(signData(getContext().getKey(), parent.toByteArray())))
);
@ -78,13 +78,13 @@ public class ObjectTools extends ContextAccessor implements ToolsClient {
}
var grpcHeader = grpcHeaderBuilder.build();
var objectId = frostFS.refs.Types.ObjectID.newBuilder().setValue(getSha256(grpcHeader)).build();
var objectId = frostfs.refs.Types.ObjectID.newBuilder().setValue(getSha256(grpcHeader)).build();
return Types.Object.newBuilder()
.setHeader(grpcHeader)
.setObjectId(objectId)
.setPayload(ByteString.copyFrom(objectFrostFs.getPayload()))
.setSignature(
frostFS.refs.Types.Signature.newBuilder()
frostfs.refs.Types.Signature.newBuilder()
.setKey(ByteString.copyFrom(getContext().getKey().getPublicKeyByte()))
.setSign(ByteString.copyFrom(signData(getContext().getKey(), objectId.toByteArray())))
)

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import frostFS.object.ObjectServiceGrpc;
import frostFS.object.Service;
import frostfs.object.ObjectServiceGrpc;
import frostfs.object.Service;
import io.grpc.stub.StreamObserver;
import static java.util.Objects.isNull;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import frostFS.object.Service;
import info.FrostFS.sdk.tools.Verifier;
import frostfs.object.Service;
import info.frostfs.sdk.tools.Verifier;
import java.util.Iterator;
import java.util.List;
@ -13,7 +13,7 @@ public class SearchReader {
this.call = call;
}
public List<frostFS.refs.Types.ObjectID> read() {
public List<frostfs.refs.Types.ObjectID> read() {
if (!call.hasNext()) {
return null;
}

View file

@ -1,17 +1,18 @@
package info.FrostFS.sdk.services.impl;
package info.frostfs.sdk.services.impl;
import frostFS.session.Service;
import frostFS.session.SessionServiceGrpc;
import frostFS.session.Types;
import info.FrostFS.sdk.dto.SessionToken;
import info.FrostFS.sdk.jdo.ClientEnvironment;
import info.FrostFS.sdk.mappers.OwnerIdMapper;
import info.FrostFS.sdk.mappers.SessionMapper;
import info.FrostFS.sdk.services.ContextAccessor;
import info.FrostFS.sdk.services.SessionClient;
import frostfs.session.Service;
import frostfs.session.SessionServiceGrpc;
import frostfs.session.Types;
import info.frostfs.sdk.dto.SessionToken;
import info.frostfs.sdk.jdo.ClientEnvironment;
import info.frostfs.sdk.mappers.OwnerIdMapper;
import info.frostfs.sdk.mappers.SessionMapper;
import info.frostfs.sdk.services.ContextAccessor;
import info.frostfs.sdk.services.SessionClient;
import info.frostfs.sdk.tools.RequestConstructor;
import static info.FrostFS.sdk.tools.RequestConstructor.addMetaHeader;
import static info.FrostFS.sdk.tools.RequestSigner.sign;
import static info.frostfs.sdk.tools.RequestConstructor.addMetaHeader;
import static info.frostfs.sdk.tools.RequestSigner.sign;
public class SessionService extends ContextAccessor implements SessionClient {
private final SessionServiceGrpc.SessionServiceBlockingStub serviceBlockingStub;
@ -36,7 +37,7 @@ public class SessionService extends ContextAccessor implements SessionClient {
.setExpiration(expiration).build()
);
addMetaHeader(request);
RequestConstructor.addMetaHeader(request);
sign(request, getContext().getKey());
return createSession(request.build());

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.tools;
package info.frostfs.sdk.tools;
import io.grpc.Channel;
import io.grpc.ChannelCredentials;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.tools;
package info.frostfs.sdk.tools;
import com.google.protobuf.Message;
import com.google.protobuf.MessageOrBuilder;

View file

@ -1,15 +1,15 @@
package info.FrostFS.sdk.tools;
package info.frostfs.sdk.tools;
import com.google.protobuf.Message;
import frostFS.session.Types;
import info.FrostFS.sdk.dto.MetaHeader;
import info.FrostFS.sdk.jdo.ECDsa;
import info.FrostFS.sdk.mappers.MetaHeaderMapper;
import frostfs.session.Types;
import info.frostfs.sdk.dto.MetaHeader;
import info.frostfs.sdk.jdo.ECDsa;
import info.frostfs.sdk.mappers.MetaHeaderMapper;
import static info.FrostFS.sdk.constants.FieldConst.META_HEADER_FIELD_NAME;
import static info.FrostFS.sdk.tools.MessageHelper.getField;
import static info.FrostFS.sdk.tools.MessageHelper.setField;
import static info.FrostFS.sdk.tools.RequestSigner.signMessagePart;
import static info.frostfs.sdk.constants.FieldConst.META_HEADER_FIELD_NAME;
import static info.frostfs.sdk.tools.MessageHelper.getField;
import static info.frostfs.sdk.tools.MessageHelper.setField;
import static info.frostfs.sdk.tools.RequestSigner.signMessagePart;
import static java.util.Objects.isNull;
public class RequestConstructor {
@ -27,8 +27,8 @@ public class RequestConstructor {
public static void addObjectSessionToken(Message.Builder request,
Types.SessionToken sessionToken,
frostFS.refs.Types.ContainerID cid,
frostFS.refs.Types.ObjectID oid,
frostfs.refs.Types.ContainerID cid,
frostfs.refs.Types.ObjectID oid,
Types.ObjectSessionContext.Verb verb,
ECDsa key) {
var header = (Types.RequestMetaHeader) getField(request, META_HEADER_FIELD_NAME);

View file

@ -1,9 +1,10 @@
package info.FrostFS.sdk.tools;
package info.frostfs.sdk.tools;
import com.google.protobuf.ByteString;
import com.google.protobuf.Message;
import frostFS.session.Types;
import info.FrostFS.sdk.jdo.ECDsa;
import frostfs.session.Types;
import info.frostfs.sdk.jdo.ECDsa;
import info.frostfs.sdk.constants.CryptoConst;
import org.apache.commons.codec.digest.DigestUtils;
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.sec.SECObjectIdentifiers;
@ -15,10 +16,7 @@ import org.bouncycastle.crypto.signers.HMacDSAKCalculator;
import java.math.BigInteger;
import java.security.Signature;
import static info.FrostFS.sdk.constants.CryptoConst.SIGNATURE_ALGORITHM;
import static info.FrostFS.sdk.constants.FieldConst.*;
import static info.FrostFS.sdk.tools.MessageHelper.getField;
import static info.FrostFS.sdk.tools.MessageHelper.setField;
import static info.frostfs.sdk.constants.FieldConst.*;
import static org.bouncycastle.crypto.util.DigestFactory.createSHA256;
import static org.bouncycastle.util.BigIntegers.asUnsignedByteArray;
@ -30,7 +28,7 @@ public class RequestSigner {
var hash = new byte[65];
hash[0] = 0x04;
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
Signature signature = Signature.getInstance(CryptoConst.SIGNATURE_ALGORITHM);
signature.initSign(key.getPrivateKey());
signature.update(DigestUtils.sha512(data));
byte[] sig = signature.sign();
@ -67,33 +65,33 @@ public class RequestSigner {
return signature;
}
public static frostFS.refs.Types.SignatureRFC6979 signRFC6979(ECDsa key, Message message) {
return frostFS.refs.Types.SignatureRFC6979.newBuilder()
public static frostfs.refs.Types.SignatureRFC6979 signRFC6979(ECDsa key, Message message) {
return frostfs.refs.Types.SignatureRFC6979.newBuilder()
.setKey(ByteString.copyFrom(key.getPublicKeyByte()))
.setSign(ByteString.copyFrom(signRFC6979(key, message.toByteArray())))
.build();
}
public static frostFS.refs.Types.SignatureRFC6979 signRFC6979(ECDsa key, ByteString data) {
return frostFS.refs.Types.SignatureRFC6979.newBuilder()
public static frostfs.refs.Types.SignatureRFC6979 signRFC6979(ECDsa key, ByteString data) {
return frostfs.refs.Types.SignatureRFC6979.newBuilder()
.setKey(ByteString.copyFrom(key.getPublicKeyByte()))
.setSign(ByteString.copyFrom(signRFC6979(key, data.toByteArray())))
.build();
}
public static frostFS.refs.Types.Signature signMessagePart(ECDsa key, Message data) {
public static frostfs.refs.Types.Signature signMessagePart(ECDsa key, Message data) {
var data2Sign = data.getSerializedSize() == 0 ? new byte[]{} : data.toByteArray();
return frostFS.refs.Types.Signature.newBuilder()
return frostfs.refs.Types.Signature.newBuilder()
.setKey(ByteString.copyFrom(key.getPublicKeyByte()))
.setSign(ByteString.copyFrom(signData(key, data2Sign)))
.build();
}
public static void sign(Message.Builder request, ECDsa key) {
var meta = getField(request, META_HEADER_FIELD_NAME);
var body = getField(request, BODY_FIELD_NAME);
var verify = getField(request, VERIFY_HEADER_FIELD_NAME);
var verifyOrigin = getField(verify, ORIGIN_FIELD_NAME);
var meta = MessageHelper.getField(request, META_HEADER_FIELD_NAME);
var body = MessageHelper.getField(request, BODY_FIELD_NAME);
var verify = MessageHelper.getField(request, VERIFY_HEADER_FIELD_NAME);
var verifyOrigin = MessageHelper.getField(verify, ORIGIN_FIELD_NAME);
Message.Builder verifyBuilder;
if (verify instanceof Types.RequestVerificationHeader) {
@ -107,14 +105,14 @@ public class RequestSigner {
}
if (verifyOrigin.getSerializedSize() == 0) {
setField(verifyBuilder, BODY_SIGNATURE_FIELD_NAME, signMessagePart(key, body));
MessageHelper.setField(verifyBuilder, BODY_SIGNATURE_FIELD_NAME, signMessagePart(key, body));
} else {
setField(verifyBuilder, ORIGIN_FIELD_NAME, verifyOrigin);
MessageHelper.setField(verifyBuilder, ORIGIN_FIELD_NAME, verifyOrigin);
}
setField(verifyBuilder, META_SIGNATURE_FIELD_NAME, signMessagePart(key, meta));
setField(verifyBuilder, ORIGIN_SIGNATURE_FIELD_NAME, signMessagePart(key, verifyOrigin));
setField(request, VERIFY_HEADER_FIELD_NAME, verifyBuilder.build());
MessageHelper.setField(verifyBuilder, META_SIGNATURE_FIELD_NAME, signMessagePart(key, meta));
MessageHelper.setField(verifyBuilder, ORIGIN_SIGNATURE_FIELD_NAME, signMessagePart(key, verifyOrigin));
MessageHelper.setField(request, VERIFY_HEADER_FIELD_NAME, verifyBuilder.build());
}
}

View file

@ -1,8 +1,9 @@
package info.FrostFS.sdk.tools;
package info.frostfs.sdk.tools;
import com.google.protobuf.Message;
import frostFS.session.Types;
import info.FrostFS.sdk.mappers.StatusMapper;
import frostfs.session.Types;
import info.frostfs.sdk.mappers.StatusMapper;
import info.frostfs.sdk.constants.CryptoConst;
import org.apache.commons.codec.digest.DigestUtils;
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.sec.SECObjectIdentifiers;
@ -16,10 +17,8 @@ import java.security.PublicKey;
import java.security.Signature;
import java.util.Arrays;
import static info.FrostFS.sdk.KeyExtension.getPublicKeyFromBytes;
import static info.FrostFS.sdk.constants.CryptoConst.SIGNATURE_ALGORITHM;
import static info.FrostFS.sdk.constants.FieldConst.*;
import static info.FrostFS.sdk.tools.MessageHelper.getField;
import static info.frostfs.sdk.KeyExtension.getPublicKeyFromBytes;
import static info.frostfs.sdk.constants.FieldConst.*;
import static java.util.Objects.isNull;
import static org.bouncycastle.crypto.util.DigestFactory.createSHA256;
import static org.bouncycastle.util.BigIntegers.fromUnsignedByteArray;
@ -29,7 +28,7 @@ public class Verifier {
public static final String ERROR_INVALID_RESPONSE = "Invalid response";
public static final int RFC6979_SIG_SIZE = 64;
public static boolean verifyRFC6979(frostFS.refs.Types.SignatureRFC6979 signature, Message data) {
public static boolean verifyRFC6979(frostfs.refs.Types.SignatureRFC6979 signature, Message data) {
return verifyRFC6979(signature.getKey().toByteArray(), data.toByteArray(), signature.getSign().toByteArray());
}
@ -68,7 +67,7 @@ public class Verifier {
throw new IllegalArgumentException(ERROR_INVALID_RESPONSE);
}
var metaHeader = (Types.ResponseMetaHeader) getField(response, META_HEADER_FIELD_NAME);
var metaHeader = (Types.ResponseMetaHeader) MessageHelper.getField(response, META_HEADER_FIELD_NAME);
var status = StatusMapper.toModel(metaHeader.getStatus());
if (!status.isSuccess()) {
throw new IllegalArgumentException(status.toString());
@ -76,16 +75,16 @@ public class Verifier {
}
public static boolean verify(Message response) {
var body = getField(response, BODY_FIELD_NAME);
var metaHeader = (Types.ResponseMetaHeader) getField(response, META_HEADER_FIELD_NAME);
var verifyHeader = (Types.ResponseVerificationHeader) getField(response, VERIFY_HEADER_FIELD_NAME);
var body = MessageHelper.getField(response, BODY_FIELD_NAME);
var metaHeader = (Types.ResponseMetaHeader) MessageHelper.getField(response, META_HEADER_FIELD_NAME);
var verifyHeader = (Types.ResponseVerificationHeader) MessageHelper.getField(response, VERIFY_HEADER_FIELD_NAME);
return verifyMatryoshkaLevel(body, metaHeader, verifyHeader);
}
public static boolean verifyMatryoshkaLevel(Message data,
frostFS.session.Types.ResponseMetaHeader meta,
frostFS.session.Types.ResponseVerificationHeader verification) {
frostfs.session.Types.ResponseMetaHeader meta,
frostfs.session.Types.ResponseVerificationHeader verification) {
if (!verifyMessagePart(verification.getMetaSignature(), meta)) return false;
var origin = verification.getOrigin();
if (!verifyMessagePart(verification.getOriginSignature(), origin)) return false;
@ -96,7 +95,7 @@ public class Verifier {
&& verifyMatryoshkaLevel(data, meta.getOrigin(), origin);
}
public static boolean verifyMessagePart(frostFS.refs.Types.Signature sig, Message data) {
public static boolean verifyMessagePart(frostfs.refs.Types.Signature sig, Message data) {
if (sig.getSerializedSize() == 0 || sig.getKey().isEmpty() || sig.getSign().isEmpty()) return false;
var publicKey = getPublicKeyFromBytes(sig.getKey().toByteArray());
@ -107,7 +106,7 @@ public class Verifier {
public static boolean verifyData(PublicKey publicKey, byte[] data, byte[] sig) {
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
Signature signature = Signature.getInstance(CryptoConst.SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(DigestUtils.sha512(data));
return signature.verify(Arrays.copyOfRange(sig, 1, sig.length));

View file

@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>info.FrostFS.sdk</groupId>
<artifactId>FrostFS-sdk-java</artifactId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>frostfs-sdk-java</artifactId>
<version>0.1.0</version>
</parent>

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk;
package info.frostfs.sdk;
public class ArrayHelper {

View file

@ -1,9 +1,9 @@
package info.FrostFS.sdk;
package info.frostfs.sdk;
import java.util.Arrays;
import static info.FrostFS.sdk.ArrayHelper.concat;
import static info.FrostFS.sdk.Helper.getSha256;
import static info.frostfs.sdk.ArrayHelper.concat;
import static info.frostfs.sdk.Helper.getSha256;
import static java.util.Objects.isNull;
public class Base58 {

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk;
package info.frostfs.sdk;
import com.google.protobuf.ByteString;
import com.google.protobuf.Message;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk;
package info.frostfs.sdk;
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.sec.SECObjectIdentifiers;
@ -23,8 +23,8 @@ import java.security.spec.ECPublicKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
import static info.FrostFS.sdk.Helper.getRIPEMD160;
import static info.FrostFS.sdk.Helper.getSha256;
import static info.frostfs.sdk.Helper.getRIPEMD160;
import static info.frostfs.sdk.Helper.getSha256;
import static org.bouncycastle.util.BigIntegers.fromUnsignedByteArray;
public class KeyExtension {

View file

@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>info.FrostFS.sdk</groupId>
<artifactId>FrostFS-sdk-java</artifactId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>frostfs-sdk-java</artifactId>
<version>0.1.0</version>
</parent>
@ -24,12 +24,12 @@
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>info.FrostFS.sdk</groupId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>cryptography</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>info.FrostFS.sdk</groupId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>protos</artifactId>
<version>0.1.0</version>
</dependency>

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk;
package info.frostfs.sdk;
import java.nio.ByteBuffer;
import java.util.UUID;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.constants;
package info.frostfs.sdk.constants;
public class AppConst {
public static final int OBJECT_CHUNK_SIZE = 3 * (1 << 20);

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.constants;
package info.frostfs.sdk.constants;
public class FieldConst {
public static final String META_HEADER_FIELD_NAME = "meta_header";

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.constants;
package info.frostfs.sdk.constants;
public class XHeaderConst {
public static final String RESERVED_XHEADER_PREFIX = "__SYSTEM__";

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
public class MetaHeader {
private Version version;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
import info.FrostFS.sdk.Base58;
import info.frostfs.sdk.Base58;
import static info.FrostFS.sdk.KeyExtension.publicKeyToAddress;
import static info.frostfs.sdk.KeyExtension.publicKeyToAddress;
public class OwnerId {
private final String value;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
public class SessionToken {
private final byte[] id;

View file

@ -1,6 +1,6 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
import info.FrostFS.sdk.enums.SignatureScheme;
import info.frostfs.sdk.enums.SignatureScheme;
public class Signature {
private byte[] key;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.dto.object.ObjectId;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.dto.object.ObjectId;
import java.util.ArrayList;
import java.util.List;

View file

@ -1,9 +1,9 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
import java.util.UUID;
import static info.FrostFS.sdk.UUIDExtension.asBytes;
import static info.FrostFS.sdk.UUIDExtension.asUuid;
import static info.frostfs.sdk.UUIDExtension.asBytes;
import static info.frostfs.sdk.UUIDExtension.asUuid;
import static java.util.Objects.isNull;
public class SplitId {

View file

@ -1,6 +1,6 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
import info.FrostFS.sdk.enums.StatusCode;
import info.frostfs.sdk.enums.StatusCode;
import static java.util.Objects.isNull;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto;
package info.frostfs.sdk.dto;
public class Version {
private int major;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.dto.container;
package info.frostfs.sdk.dto.container;
import info.FrostFS.sdk.dto.Version;
import info.FrostFS.sdk.dto.netmap.PlacementPolicy;
import info.FrostFS.sdk.enums.BasicAcl;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.dto.netmap.PlacementPolicy;
import info.frostfs.sdk.enums.BasicAcl;
import java.util.UUID;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.dto.container;
package info.frostfs.sdk.dto.container;
import info.FrostFS.sdk.Base58;
import info.FrostFS.sdk.constants.AppConst;
import info.frostfs.sdk.Base58;
import info.frostfs.sdk.constants.AppConst;
public class ContainerId {
private String value;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto.netmap;
package info.frostfs.sdk.dto.netmap;
import java.util.List;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.dto.netmap;
package info.frostfs.sdk.dto.netmap;
import info.FrostFS.sdk.dto.Version;
import info.FrostFS.sdk.enums.NodeState;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.enums.NodeState;
import java.util.List;
import java.util.Map;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto.netmap;
package info.frostfs.sdk.dto.netmap;
public class PlacementPolicy {
private final Replica[] replicas;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto.netmap;
package info.frostfs.sdk.dto.netmap;
import static java.util.Objects.isNull;

View file

@ -1,10 +1,10 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.container.ContainerId;
import java.security.MessageDigest;
import static info.FrostFS.sdk.Helper.getSha256Instance;
import static info.frostfs.sdk.Helper.getSha256Instance;
public class LargeObject extends ObjectFrostFS {
private final MessageDigest payloadHash;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
import info.FrostFS.sdk.dto.Split;
import info.FrostFS.sdk.dto.SplitId;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.Split;
import info.frostfs.sdk.dto.SplitId;
import info.frostfs.sdk.dto.container.ContainerId;
import java.util.List;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
public class ObjectAttribute {
private String key;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
import info.FrostFS.sdk.dto.OwnerId;
import info.FrostFS.sdk.dto.Version;
import info.FrostFS.sdk.enums.ObjectMatchType;
import info.frostfs.sdk.dto.OwnerId;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.enums.ObjectMatchType;
public class ObjectFilter {
private static final String HEADER_PREFIX = "$Object:";

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
import info.FrostFS.sdk.dto.Split;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.enums.ObjectType;
import info.frostfs.sdk.dto.Split;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.enums.ObjectType;
import java.util.ArrayList;
import java.util.List;

View file

@ -1,10 +1,10 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
import info.FrostFS.sdk.dto.OwnerId;
import info.FrostFS.sdk.dto.Split;
import info.FrostFS.sdk.dto.Version;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.enums.ObjectType;
import info.frostfs.sdk.dto.OwnerId;
import info.frostfs.sdk.dto.Split;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.enums.ObjectType;
import java.util.List;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.dto.object;
package info.frostfs.sdk.dto.object;
import info.FrostFS.sdk.Base58;
import info.FrostFS.sdk.constants.AppConst;
import info.frostfs.sdk.Base58;
import info.frostfs.sdk.constants.AppConst;
public class ObjectId {
private final String value;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.enums;
package info.frostfs.sdk.enums;
import java.util.Collections;
import java.util.HashMap;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.enums;
package info.frostfs.sdk.enums;
import java.util.Collections;
import java.util.HashMap;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.enums;
package info.frostfs.sdk.enums;
public enum ObjectMatchType {
UNSPECIFIED(0),

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.enums;
package info.frostfs.sdk.enums;
import java.util.Collections;
import java.util.HashMap;

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.enums;
package info.frostfs.sdk.enums;
public enum SignatureScheme {
ECDSA_SHA512(0),

View file

@ -1,4 +1,4 @@
package info.FrostFS.sdk.enums;
package info.frostfs.sdk.enums;
import java.util.Collections;
import java.util.HashMap;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.mappers;
package info.frostfs.sdk.mappers;
import frostFS.session.Types;
import info.FrostFS.sdk.dto.MetaHeader;
import frostfs.session.Types;
import info.frostfs.sdk.dto.MetaHeader;
public class MetaHeaderMapper {

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers;
package info.frostfs.sdk.mappers;
import com.google.protobuf.ByteString;
import frostFS.refs.Types;
import info.FrostFS.sdk.dto.OwnerId;
import frostfs.refs.Types;
import info.frostfs.sdk.dto.OwnerId;
public class OwnerIdMapper {

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers;
package info.frostfs.sdk.mappers;
import com.google.protobuf.CodedOutputStream;
import com.google.protobuf.InvalidProtocolBufferException;
import frostFS.session.Types;
import frostfs.session.Types;
import java.io.IOException;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers;
package info.frostfs.sdk.mappers;
import com.google.protobuf.ByteString;
import frostFS.refs.Types;
import info.FrostFS.sdk.dto.Signature;
import frostfs.refs.Types;
import info.frostfs.sdk.dto.Signature;
import static java.util.Objects.isNull;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers;
package info.frostfs.sdk.mappers;
import frostFS.status.Types;
import info.FrostFS.sdk.dto.Status;
import info.FrostFS.sdk.enums.StatusCode;
import frostfs.status.Types;
import info.frostfs.sdk.dto.Status;
import info.frostfs.sdk.enums.StatusCode;
import static java.util.Objects.isNull;

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.mappers;
package info.frostfs.sdk.mappers;
import frostFS.refs.Types;
import info.FrostFS.sdk.dto.Version;
import frostfs.refs.Types;
import info.frostfs.sdk.dto.Version;
public class VersionMapper {

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers.container;
package info.frostfs.sdk.mappers.container;
import com.google.protobuf.ByteString;
import frostFS.refs.Types;
import info.FrostFS.sdk.dto.container.ContainerId;
import frostfs.refs.Types;
import info.frostfs.sdk.dto.container.ContainerId;
public class ContainerIdMapper {

View file

@ -1,14 +1,14 @@
package info.FrostFS.sdk.mappers.container;
package info.frostfs.sdk.mappers.container;
import com.google.protobuf.ByteString;
import frostFS.container.Types;
import info.FrostFS.sdk.dto.container.Container;
import info.FrostFS.sdk.enums.BasicAcl;
import info.FrostFS.sdk.mappers.VersionMapper;
import info.FrostFS.sdk.mappers.netmap.PlacementPolicyMapper;
import frostfs.container.Types;
import info.frostfs.sdk.dto.container.Container;
import info.frostfs.sdk.enums.BasicAcl;
import info.frostfs.sdk.mappers.VersionMapper;
import info.frostfs.sdk.mappers.netmap.PlacementPolicyMapper;
import static info.FrostFS.sdk.UUIDExtension.asBytes;
import static info.FrostFS.sdk.UUIDExtension.asUuid;
import static info.frostfs.sdk.UUIDExtension.asBytes;
import static info.frostfs.sdk.UUIDExtension.asUuid;
import static java.util.Objects.isNull;
public class ContainerMapper {

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.mappers.netmap;
package info.frostfs.sdk.mappers.netmap;
import frostFS.netmap.Service;
import info.FrostFS.sdk.dto.netmap.NetmapSnapshot;
import frostfs.netmap.Service;
import info.frostfs.sdk.dto.netmap.NetmapSnapshot;
import java.util.stream.Collectors;

View file

@ -1,11 +1,11 @@
package info.FrostFS.sdk.mappers.netmap;
package info.frostfs.sdk.mappers.netmap;
import frostFS.netmap.Service;
import frostFS.netmap.Types.NodeInfo.Attribute;
import frostFS.refs.Types;
import info.FrostFS.sdk.dto.netmap.NodeInfo;
import info.FrostFS.sdk.enums.NodeState;
import info.FrostFS.sdk.mappers.VersionMapper;
import frostfs.netmap.Service;
import frostfs.netmap.Types.NodeInfo.Attribute;
import frostfs.refs.Types;
import info.frostfs.sdk.dto.netmap.NodeInfo;
import info.frostfs.sdk.enums.NodeState;
import info.frostfs.sdk.mappers.VersionMapper;
import java.util.stream.Collectors;
@ -17,7 +17,7 @@ public class NodeInfoMapper {
return toModel(nodeInfo.getNodeInfo(), nodeInfo.getVersion());
}
public static NodeInfo toModel(frostFS.netmap.Types.NodeInfo nodeInfo, Types.Version version) {
public static NodeInfo toModel(frostfs.netmap.Types.NodeInfo nodeInfo, Types.Version version) {
NodeState nodeState = NodeState.get(nodeInfo.getState().getNumber());
if (isNull(nodeState)) {
throw new IllegalArgumentException(

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers.netmap;
package info.frostfs.sdk.mappers.netmap;
import frostFS.netmap.Types;
import info.FrostFS.sdk.dto.netmap.PlacementPolicy;
import info.FrostFS.sdk.dto.netmap.Replica;
import frostfs.netmap.Types;
import info.frostfs.sdk.dto.netmap.PlacementPolicy;
import info.frostfs.sdk.dto.netmap.Replica;
public class PlacementPolicyMapper {

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.mappers.netmap;
package info.frostfs.sdk.mappers.netmap;
import frostFS.netmap.Types;
import info.FrostFS.sdk.dto.netmap.Replica;
import frostfs.netmap.Types;
import info.frostfs.sdk.dto.netmap.Replica;
public class ReplicaMapper {

View file

@ -1,7 +1,7 @@
package info.FrostFS.sdk.mappers.object;
package info.frostfs.sdk.mappers.object;
import frostFS.object.Types;
import info.FrostFS.sdk.dto.object.ObjectAttribute;
import frostfs.object.Types;
import info.frostfs.sdk.dto.object.ObjectAttribute;
public class ObjectAttributeMapper {

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers.object;
package info.frostfs.sdk.mappers.object;
import frostFS.object.Service;
import frostFS.object.Types;
import info.FrostFS.sdk.dto.object.ObjectFilter;
import frostfs.object.Service;
import frostfs.object.Types;
import info.frostfs.sdk.dto.object.ObjectFilter;
import static java.util.Objects.isNull;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers.object;
package info.frostfs.sdk.mappers.object;
import frostFS.object.Types;
import info.FrostFS.sdk.dto.object.ObjectFrostFS;
import info.FrostFS.sdk.dto.object.ObjectId;
import frostfs.object.Types;
import info.frostfs.sdk.dto.object.ObjectFrostFS;
import info.frostfs.sdk.dto.object.ObjectId;
public class ObjectFrostFSMapper {

View file

@ -1,12 +1,12 @@
package info.FrostFS.sdk.mappers.object;
package info.frostfs.sdk.mappers.object;
import frostFS.object.Types;
import info.FrostFS.sdk.dto.container.ContainerId;
import info.FrostFS.sdk.dto.object.ObjectAttribute;
import info.FrostFS.sdk.dto.object.ObjectHeader;
import info.FrostFS.sdk.enums.ObjectType;
import info.FrostFS.sdk.mappers.VersionMapper;
import info.FrostFS.sdk.mappers.container.ContainerIdMapper;
import frostfs.object.Types;
import info.frostfs.sdk.dto.container.ContainerId;
import info.frostfs.sdk.dto.object.ObjectAttribute;
import info.frostfs.sdk.dto.object.ObjectHeader;
import info.frostfs.sdk.enums.ObjectType;
import info.frostfs.sdk.mappers.VersionMapper;
import info.frostfs.sdk.mappers.container.ContainerIdMapper;
import java.util.stream.Collectors;

View file

@ -1,8 +1,8 @@
package info.FrostFS.sdk.mappers.object;
package info.frostfs.sdk.mappers.object;
import com.google.protobuf.ByteString;
import frostFS.refs.Types;
import info.FrostFS.sdk.dto.object.ObjectId;
import frostfs.refs.Types;
import info.frostfs.sdk.dto.object.ObjectId;
public class ObjectIdMapper {

View file

@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>info.FrostFS.sdk</groupId>
<artifactId>FrostFS-sdk-java</artifactId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>frostfs-sdk-java</artifactId>
<version>0.1.0</version>
<packaging>pom</packaging>
<modules>

View file

@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>info.FrostFS.sdk</groupId>
<artifactId>FrostFS-sdk-java</artifactId>
<groupId>info.frostfs.sdk</groupId>
<artifactId>frostfs-sdk-java</artifactId>
<version>0.1.0</version>
</parent>

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.accounting;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc;accounting";
option java_package = "frostFS.accounting";
option java_package = "frostfs.accounting";
import "accounting/types.proto";
import "refs/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.accounting;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc;accounting";
option java_package = "frostFS.accounting";
option java_package = "frostfs.accounting";
// Standard floating point data type can't be used in NeoFS due to inexactness
// of the result when doing lots of small number operations. To solve the lost

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.acl;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc;acl";
option java_package = "frostFS.acl";
option java_package = "frostfs.acl";
import "refs/types.proto";

View file

@ -6,7 +6,7 @@ import "apemanager/types.proto";
import "session/types.proto";
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc;apemanager";
option java_package = "frostFS.apemanager";
option java_package = "frostfs.apemanager";
// `APEManagerService` provides API to manage rule chains within sidechain's
// `Policy` smart contract.

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package frostfs.v2.apemanager;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc;apemanager";
option java_package = "frostFS.apemanager";
option java_package = "frostfs.apemanager";
// TargetType is a type target to which a rule chain is defined.
enum TargetType {

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.container;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc;container";
option java_package = "frostFS.container";
option java_package = "frostfs.container";
import "acl/types.proto";
import "container/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.container;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc;container";
option java_package = "frostFS.container";
option java_package = "frostfs.container";
import "netmap/types.proto";
import "refs/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.lock;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/lock/grpc;lock";
option java_package = "frostFS.lock";
option java_package = "frostfs.lock";
import "refs/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.netmap;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc;netmap";
option java_package = "frostFS.netmap";
option java_package = "frostfs.netmap";
import "netmap/types.proto";
import "refs/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.netmap;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc;netmap";
option java_package = "frostFS.netmap";
option java_package = "frostfs.netmap";
// Operations on filters
enum Operation {

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.object;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc;object";
option java_package = "frostFS.object";
option java_package = "frostfs.object";
import "object/types.proto";
import "refs/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.object;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc;object";
option java_package = "frostFS.object";
option java_package = "frostfs.object";
import "refs/types.proto";
import "session/types.proto";

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.refs;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc;refs";
option java_package = "frostFS.refs";
option java_package = "frostfs.refs";
// Objects in NeoFS are addressed by their ContainerID and ObjectID.
//

View file

@ -3,7 +3,7 @@ syntax = "proto3";
package neo.fs.v2.session;
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc;session";
option java_package = "frostFS.session";
option java_package = "frostfs.session";
import "refs/types.proto";
import "session/types.proto";

Some files were not shown because too many files have changed in this diff Show more