BiodbRequestSchedulerRule {biodb} | R Documentation

## Scheduler rule class.

### Description

Scheduler rule class.

Scheduler rule class.

### Details

This class represents a rule for the request scheduler.

### Methods

#### Public methods

- `BiodbRequestSchedulerRule$new()`

- `BiodbRequestSchedulerRule$getHost()`

- `BiodbRequestSchedulerRule$getN()`

- `BiodbRequestSchedulerRule$getT()`

- `BiodbRequestSchedulerRule$setFrequency()`

- `BiodbRequestSchedulerRule$getConnectors()`

- `BiodbRequestSchedulerRule$addConnector()`

- `BiodbRequestSchedulerRule$removeConnector()`

- `BiodbRequestSchedulerRule$print()`

- `BiodbRequestSchedulerRule$waitAsNeeded()`

- `BiodbRequestSchedulerRule$recomputeFrequency()`

- `BiodbRequestSchedulerRule$computeSleepTime()`

- `BiodbRequestSchedulerRule$storeCurrentTime()`

- `BiodbRequestSchedulerRule$clone()`

#### Method `new()`

Initializer.

##### Usage

    BiodbRequestSchedulerRule$new(host, conn = NULL)

##### Arguments

`host`

  The web host for which this rules is applicable.

`conn`

  The connector instance that is concerned by this rule.

##### Returns

Nothing.

#### Method `getHost()`

Gets host.

##### Usage

    BiodbRequestSchedulerRule$getHost()

##### Returns

Returns the host.

#### Method `getN()`

Gets N value. The number of connections allowed during a period of T seconds.

##### Usage

    BiodbRequestSchedulerRule$getN()

##### Returns

Returns N as an integer.

#### Method `getT()`

Gets T value. The number of seconds during which N connections are allowed.

##### Usage

    BiodbRequestSchedulerRule$getT()

##### Returns

Returns T as a numeric.

#### Method `setFrequency()`

Sets both N and T.

##### Usage

    BiodbRequestSchedulerRule$setFrequency(n, t)

##### Arguments

`n`

  The number of connections allowed during a period of t seconds, as an integer.

`t`

  The number of seconds during which n connections are allowed, as a numeric value.

##### Returns

Nothing.

#### Method `getConnectors()`

Gets connectors associaated with this rule.

##### Usage

    BiodbRequestSchedulerRule$getConnectors()

##### Returns

A list of BiodbConn objects.

#### Method `addConnector()`

Associate a connector with this rule.

##### Usage

    BiodbRequestSchedulerRule$addConnector(conn)

##### Arguments

`conn`

  A BiodbConn object.

##### Returns

Nothing.

#### Method `removeConnector()`

Disassociate a connector from this rule.

##### Usage

    BiodbRequestSchedulerRule$removeConnector(conn)

##### Arguments

`conn`

  A BiodbConn instance.

##### Returns

Nothing.

#### Method `print()`

Displays information about this instance.

##### Usage

    BiodbRequestSchedulerRule$print()

##### Returns

Nothing.

#### Method `waitAsNeeded()`

Wait (sleep) until a new request is allowed.

##### Usage

    BiodbRequestSchedulerRule$waitAsNeeded()

##### Returns

Nothing.

#### Method `recomputeFrequency()`

Recompute frequency from submitted N and T values.

##### Usage

    BiodbRequestSchedulerRule$recomputeFrequency()

##### Returns

Nothing.

#### Method `computeSleepTime()`

Compute the needed sleep time to wait until a new request is allowed, starting from the submitted time.

##### Usage

    BiodbRequestSchedulerRule$computeSleepTime(cur.time = Sys.time())

##### Arguments

`cur.time`

  Time from which to compute needed sleep time.

##### Returns

The needed sleep time in seconds.

#### Method `storeCurrentTime()`

Stores the current time.

##### Usage

    BiodbRequestSchedulerRule$storeCurrentTime(cur.time = Sys.time())

##### Arguments

`cur.time`

  The current time.

##### Returns

Nothing.

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    BiodbRequestSchedulerRule$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

### See Also

`BiodbRequestScheduler`.

[Package biodb version 1.2.2 Index]