All exported methods from the shared library are described here. You can find specific information about all exported methods below (e.g., description, parameters, and return type).
- Create client
- Delete client
- Get account balance
- Get endpoint information
- Get network information
- Create container
- Get container
- Delete container
- List containers
- Create object
- Create object with 1 attribute
- Read object
- Delete object
The structure of the responses in C is defined in the header file response.h
. The
type response
reflects a response that holds a simple string value. In order to be able to parse
it correctly, the type of the return value is returned besides the string. The typeresponsePointer
represents a byte array return value. In order to parse this, it's size and type is provided besides
the value.
pointerResponse CreateClient(char* privateKey, char* neofsEndpoint);
For all interactions with NeoFS, a client that connects to a GRPC endpoint of a NeoFS node is
needed. For this, you can use the method CreateClient()
with an endpoint to a NeoFS node and a
private key that will then be used to sign outgoing requests.
privateKey
: hexadecimal string of a private key's big-endian bytes. For example,57dfb170c7cb66b6361ae66021afc1a9a7c5be47aaeb72a82ad5ac963b6da2f9
for the WIFKzAXTwrj1VxQA746zSSMCt9g3omSDfyKnwsayEducuHvKd1LR9mx
.neofsEndpoint
: the GRPC endpoint of a NeoFS storage node. For example,grpcs://st1.t5.fs.neo.org:8082
.
This method returns a uuid (clientID
in the following) that can be used to connect to
the created NeoFS-Go client in memory. When passing the clientID
to a method, that corresponding
client is loaded from memory and used to send the corresponding request to the specified endpoint.
pointerResponse DeleteClient(char* clientID);
clientID
: The client ID.
1
, if the client was deleted successfully. Otherwise, an error.
pointerResponse GetBalance(char* clientID, char* publicKey);
This method gets the NeoFS balance the provided account has on the NeoFS smart contract on the Neo blockchain.
clientID
: The client ID.publicKey
: encoded compressed public key as hexadecimal. For example,0239e0884856c41605cd1bb660a72ccfc39df8acf576f15a3e593acaa27351b457
.
The return value is based on the type neo.fs.v2.accounting.Decimal
of
the NeoFS API.
pointerResponse GetEndpoint(char* clientID);
Gets information about the endpoint the client is interfacing with. Includes node information and what version is used in the node.
clientID
: The client ID.
The return value is based on a JSON serialized type EndpointResponse
(see schema in SCHEMAS.md).
pointerResponse GetNetworkInfo(char* clientID);
Gets the network information the client is interfacing with.
clientID
: The client ID.
The return value is based on the type neo.fs.v2.netmap.NetworkInfo
of
the NeoFS API.
response PutContainer(char* clientID, char* v2Container);
Creates a container.
clientID
: The client ID.v2Container
: The container to create. This parameter has to be based on the typeneo.fs.v2.Container
of the NeoFS API and is required to hold anOwnerID
.
The container ID.
pointerResponse GetContainer(char* clientID, char* containerID);
Gets the container header.
clientID
: The client ID.containerID
: The container ID.
The return value is based on the type neo.fs.v2.container.Container
of
the NeoFS API.
pointerResponse DeleteContainer(char* clientID, char* containerID);
Deletes a container.
clientID
: The client ID.containerID
: The container ID.
1
, if the container was deleted successfully. Otherwise, an error.
pointerResponse ListContainer(char* clientID, char* ownerPubKey);
Returns a list of containers owned by the provided public key (ownerPubKey
).
clientID
: The client ID.ownerPubKey
: The owner's encoded compressed public key as hexadecimal. For example,0239e0884856c41605cd1bb660a72ccfc39df8acf576f15a3e593acaa27351b457
.
A byte array that consists of concatenated container IDs. One container ID is 33 bytes long.
response CreateObjectWithoutAttributes(char* clientID, char* containerID, void* fileBytes, int fileSize, char* sessionSignerPrivKey);
Creates an object within the provided container. Does not add any attributes to the object.
clientID
: The client ID.containerID
: The container ID.fileBytes
: The bytes to store as an object in the container.fileSize
: The number of bytes offileBytes
.sessionSignerPrivKey
: The signer that opens the session to write the object.
The object ID.
response CreateObject(char* clientID, char* containerID, void* fileBytes, int fileSize, char* sessionSignerPrivKey, char* attributeKey, char* attributeValue);
Creates an object within the provided container. Adds exactly one attribute to the object.
Note: Adding multiple attributes to an object is currently not yet supported.
clientID
: The client ID.containerID
: The container ID.fileBytes
: The bytes to store as an object in the container.fileSize
: The number of bytes offileBytes
.sessionSignerPrivKey
: The signer that opens the session to write the object.attributeKey
: The attribute key.attributeValue
: The attribute value.
The object ID.
pointerResponse ReadObject(char* clientID, char* containerID, char* objectID, char* signer);
Reads the object with objectID from the container with containerID.
clientID
: The client ID.containerID
: The container ID.objectID
: The object ID.signer
: The signer that opens the session to read the object.
The object bytes.
response DeleteObject(char* clientID, char* containerID, char* objectID, char* signer);
Deletes an object with objectID from the container with containerID.
clientID
: The client ID.containerID
: The container ID.objectID
: The object ID.signer
: The signer that opens the session to read the object.
The tombstone object ID.
When deleting an object, an associated
tombstone
object is created to mark an object as deleted for potential replicas in the network. After some time, that tombstone will be replicated on nodes that are storing the object and eventually the nodes will delete both the initial object and the associated tombstone. In some way, it's like a pending delete request.