Package org.moera.lib.naming
Interface NamingApi
- All Known Implementing Classes:
MoeraNaming
public interface NamingApi
The
NamingApi
interface provides prototypes of Moera Naming API calls.-
Method Summary
Modifier and TypeMethodDescriptiongetAll
(long at, int page, int size) Retrieves a paginated list of all registered names up to a specific moment in time.getAllKeys
(String name, int generation) Retrieves all signing keys associated with the specified name and generation.getAllNewer
(long at, int page, int size) Retrieves a list of registered names that were created or updated after the specified timestamp.getCurrent
(String name, int generation) Retrieves the current state of a registered name based on the specified name and generation.Retrieves historical information about a registered name at a specific point in time.getSimilar
(String name) Retrieves aRegisteredNameInfo
object that represents a name similar to the specified name.Retrieves the status of the operation based on the provided operation ID.boolean
Checks whether a given name is free for registration in the naming service.put
(String name, int generation, byte[] updatingKey, String nodeUri, byte[] signingKey, Long validFrom, byte[] previousDigest, byte[] signature) Registers or updates the given name in the Moera Naming Service.
-
Method Details
-
put
UUID put(String name, int generation, byte[] updatingKey, String nodeUri, byte[] signingKey, Long validFrom, byte[] previousDigest, byte[] signature) Registers or updates the given name in the Moera Naming Service. See Architecture Overview for the detailed description of the algorithm.- Parameters:
name
- the name to be registered or updated. Required.generation
- the generation of the name. Required.updatingKey
- the public key for verifying signatures of further updates of the name. May benull
– the current key is preserved in this case.nodeUri
- URI of the REST API endpoint of the node to which the name is assigned. May benull
– the current URI is preserved in this case.signingKey
- the public signing key of the name owner. May benull
– the current key is preserved in this case.validFrom
- the moment in time (in epoch seconds) the owner's key is valid from. May benull
, ifsigningKey
is alsonull
.previousDigest
- the unique identifier as reported by a naming server of the current state of the name. Used to detect the situations when the name was changed by someone else between sending the request and processing it. May benull
, if the name was never registered before.signature
- the signature, if required,null
otherwise.- Returns:
- the unique operation ID, which can be used to track the status of the operation
-
getStatus
Retrieves the status of the operation based on the provided operation ID.- Parameters:
operationId
- the unique identifier of the operation- Returns:
- an
OperationStatusInfo
object containing details about the operation's status, ornull
if the operation ID is unknown
-
getCurrent
Retrieves the current state of a registered name based on the specified name and generation.- Parameters:
name
- the name for which the current state is to be retrievedgeneration
- the generation of the name for which the current state is required- Returns:
- a
RegisteredNameInfo
object containing the current state information of the registered name, ornull
if the name with the specified generation is not found.
-
getPast
Retrieves historical information about a registered name at a specific point in time.- Parameters:
name
- the name to retrieve information forgeneration
- the generation of the name to retrieve information forat
- the specific timestamp (in epoch seconds) for which the historical information is requested- Returns:
- a
RegisteredNameInfo
object containing details about the registered name at the specified time, ornull
if no matching information is found.
-
isFree
Checks whether a given name is free for registration in the naming service.- Parameters:
name
- the name to be checked for availabilitygeneration
- the generation of the name to check- Returns:
true
if the name is free for the specified generation,false
otherwise
-
getAllKeys
Retrieves all signing keys associated with the specified name and generation.- Parameters:
name
- the name for which the signing keys are to be retrievedgeneration
- the generation of the name- Returns:
- a list of
SigningKeyInfo
objects containing signing keys and their validity periods
-
getSimilar
Retrieves aRegisteredNameInfo
object that represents a name similar to the specified name. This may be useful for obtaining details of a name that closely resembles the one provided.- Parameters:
name
- the name to search for a similar registered name- Returns:
- an instance of
RegisteredNameInfo
containing details of a similar registered name, ornull
if no similar name is found.
-
getAll
Retrieves a paginated list of all registered names up to a specific moment in time.- Parameters:
at
- the timestamp (in epoch seconds) up to which the registered names are returnedpage
- the page number of the results (starting from 0)size
- the number of entries per page- Returns:
- a list of
RegisteredNameInfo
containing details of the registered names
-
getAllNewer
Retrieves a list of registered names that were created or updated after the specified timestamp. The results are paginated based on the provided page number and size.- Parameters:
at
- the timestamp (in epoch seconds) to filter names that are newerpage
- the page number of the results (starting from 0)size
- the number of entries per page- Returns:
- a list of
RegisteredNameInfo
objects representing the names that match the criteria, or an empty list if no such names exist
-