jomo77/server-planning 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jomo77/server-planning

Composer 安装命令:

composer create-project jomo77/server-planning

包简介

A PHP library that returns the number of servers that is required, to host a non-empty collection of virtual machines.

README 文档

README

Write a library that calculates the number of servers (which have the same configuration) needed to host a specified amount of virtual machines.

Your library should return the number of servers that is required, to host a non-empty collection of virtual machines. This means you should implement the following method (UML definition): +calculate(serverType: Server, virtualMachines: VirtualMachine[1..*]): int All servers have the same type. This type defines the hardware resources each server provides: CPU, RAM, HDD. Each virtual machine is defined by the virtual hardware resources it needs (on a server): CPU, RAM, HDD.

The algorithm for the virtual machine distribution should implement a 'first fit' strategy. This means there is no resource optimization or 'look back'. Virtual machines are always allocated on the current or the next server (in case of limited resources).

If a virtual machine is too 'big' for a server, it should be skipped. If the collection of virtual machines is empty, an exception should be thrown.

Example

- Server type = {CPU: 2, RAM: 32, HDD: 100}
- Virtual Machines = [{CPU: 1, RAM: 16, HDD: 10}, {CPU: 1, RAM: 16, HDD: 10}, {CPU: 2, RAM: 32, HDD: 100}]
- Result = 2

General Requirements: - Create a composer project with PHP version 7 or higher - Free choice of dependencies, but keep it simple - Your code should be fully (unit) tested!

Requirements

  • PHP >= 7.4

Installation

composer require jomo77/server-planning

composer create-project --prefer-dist --stability=dev jomo77/server-planning

Test

vendor\bin\phpunit

Test Windows

c:\Projekte\server-planning\vendor\bin\phpunit.bat

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-12-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固