api

package
v0.4.159 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

Introduction

This file explains the api functionality of Device Management Service (DMS). DMS exposes various endpoints through which its different functionalities can be accessed.

Stucture and organisation

Here is quick overview of the contents of this directory:

  • README: Current file which is aimed towards developers who wish to use and modify the api functionality.

  • api: This file contains router setup using Gin framework. It also applies Cross-Origin Resource Sharing (CORS) middleware and OpenTelemetry middleware for tracing. Further it lists down the endpoint URLs and the associated handler functions.

  • debug: This file contains endpoints which are only available when DEBUG mode is enabled.

  • device: This file contains endpoints to retrieve and modify the device status.

  • onboarding: This file contains endpoints related to the onboarding functionality catered towards compute providers.

  • peers: This file contains various endpoints related to the p2p functionality of DMS.

  • run: This file contains various endpoints related to the deployment and execution of jobs.

  • telemetry: This file contains the endpoint to calculate available free resources in a machine.

  • transactions: This file contains the endpoints related to blockchain transactions.

  • vm: This file contains the endpoints related to starting a firecracker VM with custom or default configuration.

All of these files have a counterpart named as *_test.go which contains the unit tests for the corresponding endpoints.

Contributing

For guidelines of how to contribute, install and test the device-management-service component which contains api package, please refer to package level documentation:

Specifications overview

Versioning and lifecycle of above mentioned specifications is aligned to the lifecycle and branching of the platform code (see branching strategy):

  • develop branches contain specifications of the functionality of current unstable branch of development at any given moment;
  • main branches contain specifications of the current production version of the platform at any given moment in time;
  • proposed branches contain new functionality and data model specifications, accepted for development, but not yet implemented.

The procedure to update the specifications is described in Specification And Documentation Procedure.

API functionality

The following sections describe the different functionality of the DMS covered in the api package.

Device Endpoints

Device Status

endpoint: /device/status
method: HTTP GET
output: Device Status

The endpoint retrieves the current status of the machine (online / offline).

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Change Device Status

endpoint: /device/status
method: HTTP POST
output: Success Message

The endpoint changes the current status of the machine.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

Onboarding endpoints

These endpoints are related to the onboarding functionality of DMS.

Create Payment Address

endpoint: /onboarding/address/new
method: HTTP GET
output: Public-Private key pair & Mnemonic

This endpoint creates a new blockchain payment address for the user.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Onboard

endpoint: /onboarding/onboard
method: HTTP POST
output: Machine Metadata

This endpoint executes the onboarding process for a compute provider device.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Get Metadata

endpoint: /onboarding/metadata
method: HTTP GET
output: Machine Metadata

This endpoint fetches the current metadata of the onboarded device.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Provisioned Capacity

endpoint: /onboarding/provisioned
method: HTTP GET
output: Provisioned Capacity

This endpoint fetches the total capacity of the machine that is onboarded to Nunet.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error None
Processes / Functions sequenceDiagram (.mermaid,.svg)
Onboard Status

endpoint: /onboarding/status
method: HTTP GET
output: Onboarding status & Metadata

This endpoint returns onboarding status of the machine along with some metadata.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Resource Config

endpoint: /onboarding/resource-config
method: HTTP POST
output: Machine Metadata

This endpoint allows the user to change the configuration of the resources onboarded to Nunet.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Offboard

endpoint: /onboarding/offboard
method: HTTP DELETE
output: Success Message

This endpoint allows the user to remove the resources onboarded to Nunet.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

Peers Endpoints

List Peers

endpoint: /peers
method: HTTP GET
output: Peer List

This endpoint gets a list of peers that the node can see within the network.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
List DHT Peers

endpoint: /peers/dht
method: HTTP GET
output: DHT Peer List

This endpoint gets a list of peers that the node has received a dht update from.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
List Kad DHT Peers

endpoint: /peers/kad-dht
method: HTTP GET
output: DHT Peer List

This endpoint gets a list of peers that the node has received a dht update from.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Self Peer Info

endpoint: /peers/self
method: HTTP GET
output: Peer Info

This endpoint gets the peer info of the libp2p node.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
List Chat

endpoint: /peers/chat
method: HTTP GET
output: List of chats

This endpoint gets the list of chat requests from peers.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Error logged to ELasticsearch entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Clear Chat

endpoint: /peers/chat/clear
method: HTTP GET
output: Message

This endpoint clears the chat request streams from peers.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Error logged to ELasticsearch entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Start Chat

endpoint: /peers/chat/start
method: HTTP GET
output: None

This endpoint starts a chat session with a peer.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success None
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Join Chat

endpoint: /peers/chat/join
method: HTTP GET
output: None

This endpoint allows the user to join a chat session started by a peer.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success None
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Dump DHT

endpoint: /dht
method: HTTP GET
output: DHT Content

This endpoint returns the entire DHT content.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Default DepReq Peer

endpoint: /peers/depreq
method: HTTP GET
output: Message including peerID

This endpoint is used to set peer as the default receipient of deployment requests by setting the peerID parameter on GET request.

Note:

  • By sending a GET request without any parameters we get the peer currently set as default deployment request receiver.

  • Sending a GET request with peerID parameter set to '0' will remove default deployment request receiver.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Clear File Transfer Requests

endpoint: /peers/file/clear
method: HTTP GET
output: Message

This endpoint is used to clear file transfer request streams from peers.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
List File Transfer Requests

endpoint: /peers/file
method: HTTP GET
output: Message

This endpoint is used to get a list of file transfer requests from peers.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Send File Transfer

endpoint: /peers/file/send
method: HTTP GET
output: NIL

This endpoint is used to initiate file transfer to a peer. Note that filePath and peerID are required arguments.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success NIL
Return payload - error entityDiagrams (.mermaid
Processes / Functions sequenceDiagram (.mermaid,.svg)
Accept File Transfer

endpoint: /peers/file/accept
method: HTTP GET
output: NIL

This endpoint is used to initiate file transfer to a peer. Note that filePath and peerID are required arguments.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success NIL
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid

Run Endpoints

Request Service

endpoint: /run/request-service
method: HTTP POST
output: Funding Response

This endpoint searches the DHT for non-busy, available devices with appropriate metadata. Then informs parameters related to blockchain to request to run a service on NuNet.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Deployment Request

endpoint: /run/deploy
method: HTTP GET
output: None

This endpoint loads deployment request from the database after a successful blockchain transaction has been made and passes it to compute provider.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success None
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
List Checkpoint

endpoint: /run/checkpoints
method: HTTP GET
output: Checkpoints

This endpoint scans lists all the files which can be used to resume a job. Returns a list of objects with absolute path and last modified date.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

Telemetry Endpoints

Get Free Resources

endpoint: /telemetry/free
method: HTTP GET
output: Free resources

This endpoint checks and returns the amount of free resources available in a machine.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

Transactions Endpoints

Get Job Transaction Hashes

endpoint: /transactions
method: HTTP GET
output: Transaction Hashes

This endpoint gets the list of transaction hashes along with the date and time of jobs done.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Request Reward

endpoint: /transactions/request-reward
method: HTTP POST
output: Reward Response

This endpoint takes request from the compute provider, talks with Oracle and releases tokens if conditions are met.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Send Transaction Status

endpoint: /transactions/send-status
method: HTTP POST
output: Transaction Status

This endpoint returns the status of a blockchain transaction such as token withrawal.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Update Transaction Status

endpoint: /transactions/update-status
method: HTTP POST
output: Message

This endpoint updates the status of saved transactions by fetching info from blockchain using koios REST API.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

VM Endpoints

Start Custom

endpoint: /vm/start-custom
method: HTTP POST
output: Message

This endpoint start a firecracker VM with custom configuration.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Start Default

endpoint: /vm/start-default
method: HTTP POST
output: Message

This endpoint start a firecracker VM with default configuration.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload entityDiagrams (.mermaid,.svg)
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

Debug Endpoints

These endpoints are only available when DEBUG mode is enabled.

Manual DHT Update

endpoint: /dht/update
method: HTTP GET
output: Message

This endpoint initiates a manual update of the DHT.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error None
Processes / Functions sequenceDiagram (.mermaid,.svg)
Cleanup Peer

endpoint: /cleanup
method: HTTP GET
output: Message

This endpoint removes a peer from the local database.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Ping Peer

endpoint: /ping
method: HTTP GET
output: Ping Peer Response

This endpoint pings a peer and checks the peer's presence in the DHT. It also returns the round trip time (RTT) for the ping.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error (input) entityDiagrams (.mermaid,.svg)
Return payload - error (process) entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Old Ping Peer

endpoint: /oldping
method: HTTP GET
output: Ping Peer Response

This endpoint pings a peer and checks the peer's presence in the DHT. It also returns the round trip time (RTT) for the ping.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error (input) entityDiagrams (.mermaid,.svg)
Return payload - error (process) entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)
Dump Kademlia DHT

endpoint: /kad-dht
method: HTTP GET
output: DHT Content

This endpoint returns the DHT contents.

Please see below for relevant specification and data models.

Spec type Location
Features / test case specifications Scenarios (.gherkin)
Request payload None
Return payload - success entityDiagrams (.mermaid,.svg)
Return payload - error entityDiagrams (.mermaid,.svg)
Processes / Functions sequenceDiagram (.mermaid,.svg)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptFileTransferHandler

func AcceptFileTransferHandler(c *gin.Context)

AcceptFileTransferHandler godoc @Summary Accept incoming file transfer @Description Accept an incoming file transfer. Incoming file transfer stream ID is a required parameter. @Tags file @Success 200 @Router /peers/file/accept [get]

func ChangeDeviceStatusHandler

func ChangeDeviceStatusHandler(c *gin.Context)

ChangeDeviceStatusHandler godoc

@Summary Change device status between online/offline @Description Change device status to online (able to receive jobs) or offline (unable to receive jobs). @Tags device @Produce json @Success 200 {string} string @Router /device/status [post]

func CleanupPeerHandler

func CleanupPeerHandler(c *gin.Context)

DEBUG

func ClearChatHandler

func ClearChatHandler(c *gin.Context)

ClearChatHandler godoc

@Summary		Clear chat requests
@Description	Clear chat request streams from peers
@Tags			chat
@Produce		json
@Success		200
@Router			/peers/chat/clear [get]

func ClearFileTransferRequestsHandler

func ClearFileTransferRequestsHandler(c *gin.Context)

ClearFileTransferRequestsHandler godoc @Summary Clear file transfer requests @Description Clear file transfer request streams from peers @Tags file @Produce json @Success 200 @Router /peers/file/clear [get]

func CreatePaymentAddressHandler

func CreatePaymentAddressHandler(c *gin.Context)

CreatePaymentAddressHandler godoc

@Summary		Create a new payment address.
@Description	Create a payment address from public key. Return payment address and private key.
@Tags			onboarding
@Produce		json
@Success		200	{object}	models.BlockchainAddressPrivKey
@Router			/onboarding/address/new [get]

func DefaultConfig

func DefaultConfig() cors.Config

DefaultConfig returns a generic default configuration mapped to localhost.

func DefaultDepReqPeerHandler

func DefaultDepReqPeerHandler(c *gin.Context)

DefaultDepReqPeerHandler godoc

@Summary		Manage default deplyment request receiver peer
@Description	Set peer as the default receipient of deployment requests by setting the peerID parameter on GET request.
@Description	Show peer set as default deployment request receiver by sending a GET request without any parameters.
@Description	Remove default deployment request receiver by sending a GET request with peerID parameter set to '0'.
@Tags			peers
@Success		200
@Router			/peers/depreq [get]

func DeploymentRequestHandler

func DeploymentRequestHandler(c *gin.Context)

DeploymentRequestHandler godoc

@Summary		Websocket endpoint responsible for sending deployment request and receiving deployment response.
@Description	Loads deployment request from the DB after a successful blockchain transaction has been made and passes it to compute provider.
@Tags			run
@Success		200	{string}	string
@Router			/run/deploy [get]

func DeviceStatusHandler

func DeviceStatusHandler(c *gin.Context)

DeviceStatusHandler godoc

@Summary Retrieve device status @Description Retrieve device status whether paused/offline (unable to receive job deployments) or online @Tags device @Produce json @Success 200 {string} string @Router /device/status [get]

func DumpDHTHandler

func DumpDHTHandler(c *gin.Context)

DumpDHTHandler godoc

@Summary		Return a dump of the dht
@Description	Returns entire DHT content
@Tags			p2p
@Produce		json
@Success		200	{string}	string
@Router			/dht [get]

func DumpKademliaDHTHandler

func DumpKademliaDHTHandler(c *gin.Context)

DEBUG

func GetFreeResourcesHandler

func GetFreeResourcesHandler(c *gin.Context)

GetFreeResourcesHandler godoc

@Summary		Returns the amount of free resources available
@Description	Checks and returns the amount of free resources available
@Tags			telemetry
@Produce		json
@Success		200
@Router			/telemetry/free [get]

func GetJobTxHashesHandler

func GetJobTxHashesHandler(c *gin.Context)

GetJobTxHashesHandler godoc

@Summary		Get list of TxHashes for jobs done.
@Description	Get list of TxHashes along with the date and time of jobs done.
@Tags			run
@Success		200		{object}	[]tokenomics.TxHashResp
@Router			/transactions [get]

func GetMetadataHandler

func GetMetadataHandler(c *gin.Context)

GetMetadataHandler godoc

@Summary		Get current device info.
@Description	Responds with metadata of current provideer
@Tags			onboarding
@Produce		json
@Success		200	{object}	models.Metadata
@Router			/onboarding/metadata [get]

func JoinChatHandler

func JoinChatHandler(c *gin.Context)

JoinChatHandler godoc

@Summary		Join chat with a peer
@Description	Join a chat session started by a peer
@Tags			chat
@Success		200
@Router			/peers/chat/join [get]

func ListChatHandler

func ListChatHandler(c *gin.Context)

ListChatHandler godoc

@Summary		List chat requests
@Description	Get a list of chat requests from peers
@Tags			chat
@Produce		json
@Success		200
@Router			/peers/chat [get]

func ListCheckpointHandler

func ListCheckpointHandler(c *gin.Context)

ListCheckpointHandler godoc

@Summary		Returns a list of absolute path to checkpoint files.
@Description	ListCheckpointHandler scans data_dir/received_checkpoints and lists all the tar.gz files which can be used to resume a job. Returns a list of objects with absolute path and last modified date.
@Tags			run
@Success		200					{object}	[]libp2p.checkpoint
@Router			/run/checkpoints [get]

func ListDHTPeersHandler

func ListDHTPeersHandler(c *gin.Context)

ListDHTPeersHandler godoc

@Summary		Return list of peers which have sent a dht update
@Description	Gets a list of peers the libp2p node has received a dht update from
@Tags			p2p
@Produce		json
@Success		200	{string}	string
@Router			/peers/dht [get]

func ListFileTransferRequestsHandler

func ListFileTransferRequestsHandler(c *gin.Context)

ListFileTransferRequestsHandler godoc @Summary List file transfer requests @Description Get a list of file transfer requests from peers @Tags file @Produce json @Success 200 @Router /peers/file [get]

func ListKadDHTPeersHandler

func ListKadDHTPeersHandler(c *gin.Context)

ListKadDHTPeersHandler godoc

@Summary		Return list of peers which have sent a dht update
@Description	Gets a list of peers the libp2p node has received a dht update from
@Tags			p2p
@Produce		json
@Success		200	{string}	string
@Router			/peers/kad-dht [get]

func ListPeersHandler

func ListPeersHandler(c *gin.Context)

ListPeersHandler godoc

@Summary		Return list of peers currently connected to
@Description	Gets a list of peers the libp2p node can see within the network and return a list of peers
@Tags			p2p
@Produce		json
@Success		200	{string}	string
@Router			/peers [get]

func ManualDHTUpdateHandler

func ManualDHTUpdateHandler(c *gin.Context)

DEBUG

func OffboardHandler

func OffboardHandler(c *gin.Context)

OffboardHandler godoc

@Summary Runs the offboarding process. @Description Offboard runs offboarding process to remove the machine from the NuNet network. @Tags onboarding @Produce json @Success 200 {string} string "device successfully offboarded" @Router /onboarding/offboard [post]

func OldPingPeerHandler

func OldPingPeerHandler(c *gin.Context)

DEBUG ONLY

func OnboardHandler

func OnboardHandler(c *gin.Context)

OnboardHandler godoc

@Summary		Runs the onboarding process.
@Description	Onboard runs onboarding script given the amount of resources to onboard.
@Tags			onboarding
@Produce		json
@Success		200	{object}	models.Metadata
@Router			/onboarding/onboard [post]

func OnboardStatusHandler

func OnboardStatusHandler(c *gin.Context)

OnboardStatusHandler godoc

@Summary		Onboarding status and other metadata.
@Description	Returns json with 5 parameters: onboarded, error, machine_uuid, metadata_path, database_path.
@Description	`onboarded` is true if the device is onboarded, false otherwise.
@Description	`error` is the error message if any related to onboarding status check
@Description	`machine_uuid` is the UUID of the machine
@Description	`metadata_path` is the path to metadataV2.json only if it exists
@Description	`database_path` is the path to nunet.db only if it exists
@Tags			onboarding
@Produce		json
@Success		200	{object} models.OnboardingStatus
@Router			/onboarding/status [get]

func PingPeerHandler

func PingPeerHandler(c *gin.Context)

DEBUG

func ProvisionedCapacityHandler

func ProvisionedCapacityHandler(c *gin.Context)

ProvisionedCapacityHandler godoc

@Summary		Returns provisioned capacity on host.
@Description	Get total memory capacity in MB and CPU capacity in MHz.
@Tags			onboarding
@Produce		json
@Success		200	{object}	models.Provisioned
@Router			/onboarding/provisioned [get]

func RequestRewardHandler

func RequestRewardHandler(c *gin.Context)

RequestRewardHandler godoc

@Summary		Get NTX tokens for work done.
@Description	HandleRequestReward takes request from the compute provider, talks with Oracle and releases tokens if conditions are met.
@Tags			run
@Param			body	body		tokenomics.ClaimCardanoTokenBody	true	"Claim Reward Body"
@Success		200		{object}	tokenomics.rewardRespToCPD
@Router			/transactions/request-reward [post]

func RequestServiceHandler

func RequestServiceHandler(c *gin.Context)

RequestServiceHandler godoc

@Summary		Informs parameters related to blockchain to request to run a service on NuNet
@Description	RequestServiceHandler searches the DHT for non-busy, available devices with appropriate metadata. Then informs parameters related to blockchain to request to run a service on NuNet.
@Tags			run
@Param			deployment_request	body		models.DeploymentRequest	true	"Deployment Request"
@Success		200					{object}	machines.fundingRespToSPD
@Router			/run/request-service [post]

func ResourceConfigHandler

func ResourceConfigHandler(c *gin.Context)

ResourceConfigHandler godoc

@Summary	changes the amount of resources of onboarded device .
@Tags		onboarding
@Produce	json
@Success	200	{object}	models.Metadata
@Router		/onboarding/resource-config [post]

func SelfPeerInfoHandler

func SelfPeerInfoHandler(c *gin.Context)

SelfPeerInfoHandler godoc

@Summary		Return self peer info
@Description	Gets self peer info of libp2p node
@Tags			p2p
@Produce		json
@Success		200	{string}	string
@Router			/peers/self [get]

func SendFileTransferHandler

func SendFileTransferHandler(c *gin.Context)

SendFileTransferHandler godoc @Summary Send a file to a peer @Description Initiate file transfer to a peer. filePath and peerID are required arguments. @Tags file @Success 200 @Router /peers/file/send [get]

func SendTxStatusHandler

func SendTxStatusHandler(c *gin.Context)

SendTxStatusHandler godoc

@Summary		Sends blockchain status of contract creation.
@Description	HandleSendStatus is used by webapps to send status of blockchain activities. Such token withdrawl.
@Tags			run
@Param			body	body		models.BlockchainTxStatus	true	"Blockchain Transaction Status Body"
@Success		200		{string}	string
@Router			/transactions/send-status [post]

func SetupRouter

func SetupRouter() *gin.Engine

func StartChatHandler

func StartChatHandler(c *gin.Context)

StartChatHandler godoc

@Summary		Start chat with a peer
@Description	Start chat session with a peer
@Tags			chat
@Success		200
@Router			/peers/chat/start [get]

func StartCustomHandler

func StartCustomHandler(c *gin.Context)
 StartCustomHandler godoc

	@Summary		Start a VM with custom configuration.
	@Description	This endpoint is an abstraction of all primitive endpoints. When invokend, it calls all primitive endpoints in a sequence.
	@Tags			vm
	@Produce		json
	@Success		200
	@Router			/vm/start-custom [post]

func StartDefaultHandler

func StartDefaultHandler(c *gin.Context)

StartDefaultHandler godoc

@Summary		Start a VM with default configuration.
@Description	Everything except kernel files and filesystem file will be set by DMS itself.
@Tags			vm
@Produce		json
@Success		200
@Router			/vm/start-default [post]

func UpdateTxStatusHandler

func UpdateTxStatusHandler(c *gin.Context)

UpdateTxStatusHandler godoc

@Summary		Updates blockchain transaction status of DB.
@Description	HandleUpdateStatus is used by webapps to update status of saved transactions with fetching info from blockchain using koios REST API.
@Tags			tx
@Param			body	body		tokenomics.UpdateTxStatusBody	true	"Transaction Status Update Body"
@Success		200		{string}	string
@Router			/transactions/update-status [post]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL