4.0.1 • Published 3 months ago

@mimik/cluster v4.0.1

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
3 months ago

cluster

Example

const cluster = require('@mimik/cluster);

 The following environment variable is set:

| Env variable name | Description | Default | Comments |
| ----------------- | ----------- | ------- | -------- |
| REGISTRATION_STATUS | status of the registration to mIT
| CLUSTER_STATUS_SERVERS | number of servers in the cluster
| CLUSTER_STATUS_UPDATED_AT | last update of the cluster
| CLUSTER_STATUS_LEASE_TIME | lease time interval

cluster~rpCluster(options) ⇒ Promise

The response is an object that has the following structure:

 {
   "data": (array of all the data of the result),
   "results": [{
     "result": ([rp-retry](http://lib.mimik360.com:4873/request-retry) response),
     "server": (cluster node that produced the result)
   }],
   "failures": [{
     "error": (error produced by the request to a cluster node)
     "server": (cluster node that produced the error)
   }]
 }

Kind: inner method of cluster
Returns: Promise - .
Category: async
Requires: module:@mimik/sumologic-winston-logger, module:@mimik/oauth-helper, module:@mimik/response-helper
Fulfil: object - Response of the request.

ParamTypeDescription
optionsobjectOptions for the request. Similar to axios options. The only difference is about the URL which does not contains the baseUrl, since this is provided by the cluster itself.

cluster~register(correlationId, retry) ⇒ Promise

Register a server to mIT.

Kind: inner method of cluster
Returns: Promise - .
Category: async
Requires: module:@mimik/sumologic-winston-logger, module:@mimik/oauth-helper, module:@mimik/address-helper
Fulfil: null or the response of rpCluster

The registration to mIT will retry at the frequency defined by REGISTRATION_RETRY. When the registration is completed a lease call in made to mIT on a regular basis. The lease time is defined by mIT. If the lease time is not defined it is set to 2 hours. When the cluster management is on, a concurrent registration is executed after a delay of aproxiatively 60 seconds to garantee the integrity of the cluster.

ParamTypeDescription
correlationIdUUID.<string>Correlation id to associate with the request.
retrybooleanFlag used when concurrent registration happens.

cluster~unRegister(correlationId) ⇒ Promise

the return object is:

{
 nbServers: "number of servers in the cluster" ,
 serverid: "server Id",
 errors: "optional array of errors which have occured while exiting",
}

Kind: inner method of cluster
Returns: Promise - .
Category: async
Requires: module:@mimik/sumologic-winston-logger, module:@mimik/oauth-helper
Fulfil: an object containing the number of servers, the serverId and in case of error, and error

ParamTypeDescription
correlationIdUUID.<string>Correlation id to associate with the request.

cluster~createItResource(c, req, res)

Create It resource endpoint.

Kind: inner method of cluster
Category: sync
Requires: module:@mimik/swagger-helper, module:@mimik/response-helper, module:@mimik/sumologic-winston-logger

ParamTypeDescription
cobjectcontext of the request (via openAPI).
reqobjectThe HTTP request.
resobjectThe HTTP response.

cluster~deleteServer(c, req, res)

Delete server endpoint.

Kind: inner method of cluster
Category: sync
Requires: module:@mimik/swagger-helper, module:@mimik/response-helper

ParamTypeDescription
cobjectcontext of the request (via openAPI).
reqobjectThe HTTP request.
resobjectThe HTTP response.
4.0.1

3 months ago

4.0.0

5 months ago

3.0.1

5 months ago

2.5.6

1 year ago

2.5.5

1 year ago

2.5.7

1 year ago

3.0.0

1 year ago

2.5.0

1 year ago

2.5.2

1 year ago

2.4.3

1 year ago

2.5.1

1 year ago

2.5.4

1 year ago

2.5.3

1 year ago

2.4.1

2 years ago

2.4.2

2 years ago

2.4.0

2 years ago

2.1.1

4 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

6 years ago