2017 © Pedro Peláez
 

library server-farm

Simulation of allocation of servers and virtual machines in a server farm

image

skocic/server-farm

Simulation of allocation of servers and virtual machines in a server farm

  • Friday, June 9, 2017
  • by sasakocic
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Server Farm

Simulation of allocation of servers and virtual machines in a server farm, (*1)

Build Status Code Style Status CodeCov CodeClimate Issue Count Issue Count, (*2)

Installation

Installed with Composer. Run this command:, (*3)

composer install

Usage

Usage can be seen from tests., (*4)

In essence we create a ServerFarm object by specifying maximum server specs(cpu, ram and hdd size). We create an array of Virtual machines and store them (bigger than maximum are skipped) with storeVmachines, and then we:, (*5)

  • read the array of allocated machines with getServers()
  • get the count with count()
  • see detailed allocation list with toString()
$vmArray = [
    new VmachineModel(1, 1, 2),
    new VmachineModel(2, 2, 1),
    new VmachineModel(3, 4, 3),
    new VmachineModel(2, 1, 2),
];
$sf = new ServerFarmModel(ServerModel::create(5, 6, 7));
$sf->storeVmachines($vmArray);
$actual = $sf->toString();
$expected = "Server list\n"
    . "1. VM(1 MHz, 1 GB, 2 GB) VM(2 MHz, 2 GB, 1 GB) remains VM(1 MHz, 3 GB, 4 GB)\n"
    . "2. VM(3 MHz, 4 GB, 3 GB) remains VM(1 MHz, 2 GB, 4 GB)\n"
    . "3. VM(2 MHz, 1 GB, 2 GB) remains VM(2 MHz, 5 GB, 5 GB)\n";
$this->assertSame($expected, $actual);
$n = $sf->count();
$this->assertSame(3, $n);

Tests

  1. Composer is a prerequisite for running the tests. Install composer globally, then run composer install to install required files.
  2. The tests can be executed by running this command from the root directory:
$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details., (*6)

License

Please see the license file for more information., (*7)

The Versions

09/06 2017

dev-master

9999999-dev

Simulation of allocation of servers and virtual machines in a server farm

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sasa Kocic

09/04 2017

v1.0

1.0.0.0

Simulation of allocation of servers and virtual machines in a server farm

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Sasa Kocic