open-index/open-npm huggingface dataset:
npm package: @infect/rda-service-manager
Description: RDA Service Manager - starting and stopping RDA services
Author: Lina van der Weg
Latest version: 2.1.2

# RDA Service Manager

starting and stopping RDA services


## API


```javascript
import ServiceManager from '@infect/rda-service-manager';

// pass the args that need to be passed to the processes
// running the service to the service manager
const manager = new ServiceManager({
    args: '--dev --log-level=error+ --log-module=*'.split(' ')
});


// start services by their name. the service manager is looking for 
// them in the node_modules and in the local file system on the same
// level as the project the service manager is executed in
await sm.startServices('rda-service-registry');

// stop a specific service, if no parameters are passed all services
// are stopped
await sm.stopServices('rda-service-registry');
```

### Constructor

The constructor accepts an array with command line paramters that 
are then passed to the child processes starting services.

```javascript
const manager = new ServiceManager({
    args: '--dev --log-level=error+ --log-module=*'.split(' ')
});
```


#### manager.startServices()

Starts services in the order passed to this function. the service 
manager is looking for the services in the node_modules and in the 
local file system on the same level as the project the service manager 
is executed in

```javascript
await sm.startServices(serviceName[, serviceName, [...]]);
```


#### manager.stopServices()

Stops the services that have one of the names passed to the method. 
If no name is passed all services are stopped. Services are stopped
in the reverse order they were started. 

```javascript
await sm.stopServices(serviceName[, serviceName, [...]]);
```
npm package: @infect/rda-service-registry
Description: Service registry for the RDA framework
Author: Lina van der Weg
Latest version: 3.1.6

# RDA Service Registry

Basically a DNS Server for RDA services. Other services can register, 
de-register themselves and lookup other service. All RDA services register
themselves at the registry in order to be consumable by other RDA services.


Please don't call the API for this service directly, use the the [Client](https://www.npmjs.com/package/@infect/rda-service-registry-client)
instead!


## RESTful API


### Resource rda-service-registry.service-instance

#### GET /rda-service-registry.service-instance?serviceType={serviceName}

Finds all service instances with a given service name. Returns their addresses
so that they can be consumed.



#### POST /rda-service-registry.service-instance

Register a service.

Parameters:
- identifier: uuid v4 string. unique identifier for the service instance
- serviceType: the name of the service (the same name is used when looking up services)
- availableMemory: the amount of memory the service can allocate
- machineId: an unique id for the server the service is running on
- ipv4address or ipv6address: an ipv4 or ipv6 url where the service can be reached



#### PATCH /rda-service-registry.service-instance/{serviceIdentifer}

Tells the registry that the service is still alive. This is required by the 
service registry in order to remove dead hosts. The interval this method has
to be called is returned by the create call as ttl value.



#### DELETE /rda-service-registry.service-instance/{serviceIdentifer}

Remove a service instance from the registry
npm package: @infect/rda-service-registry-client
Description: RDA Service Registry Client
Author: Lina van der Weg
Latest version: 2.3.5

# RDA Service Registry Client

The RDA registry client provides facilities for registering & looking up services
at the RDA service registry.


# API

***Registering as service***

The client can be used to register as a service that can be consumed by other 
services.

```javascript
import ServiceRegistryClient from '@infect/rda-service-registry-client';

// pass the service registry host to the client
const client = new ServiceRegistryClient('http://localhost:8000');

// register the service
await client.register({
    serviceName: 'test-service',
    port: 7891,
});

// de-register again
await client.deregister();
```

***Looking up a service***

The client can be used to lookup where to find other services. If one service 
was registered multiple times at the registry a random one will be returned.

```javascript
import ServiceRegistryClient from '@infect/rda-service-registry-client';

// pass the service registry host to the client
const client = new ServiceRegistryClient('http://localhost:8000');

// get the address of one random serviceName service instance
const url = await client.lookup(serviceName);
```


### Constructor

The registry client the address under which the registry service is reachable.
Thats the only parameter that needs to be passed to it. 

Attention: if you are registering yourself as service you _must_ only use one
instance of the registry client since it creates a identifier by which it is 
later identified. If you wish to use multiple instances you need to pass the 
identifier to to the register method each time it is used.


```javascript
const client = new ServiceRegistryClient('http://localhost:8000');
```



### client.register()

Register your service on the registry service so that it can be consumed by 
other services. This method should only be called once per service on one client
instance (see the warning in the Constructor documentation).

Parameters:
- serviceName: the name of your service
- port: the port your service is listening on
- identifier: optional: a unique identifier for your instance of the service 
- protocol: the protocol used to contact your service. defaults to http://

```javascript
await client.register({
    serviceName: 'test-service',
    port: 7891,
    identifer: myidentifier,
    protocol: 'http://'
});
```



### client.deregister()

De-register your service so that other services will not try to contact it again.


```javascript
await client.deregister();
```


### client.resolve()

Look up the address of another service. If multiple instances of the other 
service are available the address of a random one will be returned.

```javascript
const url = await client.lookup(serviceName);
```