定制 behzadsp/php-raid 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

behzadsp/php-raid

最新稳定版本:v2.0.1

Composer 安装命令:

composer require behzadsp/php-raid

包简介

RAID (redundant array of disks) calculation utility.

README 文档

README

A general purpose RAID (Redundant Array of Independent Disks) library in PHP.

This library can be used to build objects that represent RAIDs. This is useful if you are wanting to manage and keep track of servers in a datacenter environment or for a home lab as part of a larger project.

The library itself simply allows you to create object representations of a RAID and its underlying drives. It manages the total usable capacity of various RAID types for you, as well as hot spares, and general RAID validation for things like minimum drive count for a specific RAID level.

Currently compatible RAID types are:

  • RAID 0
  • RAID 1
  • RAID 5
  • RAID 6
  • RAID 10

Usage

To create a RAID object, you should determine which type of RAID you would like to create, and initialize it with an array of \behzadsp\Raid\Drive objects.

use behzadsp\Raid\Drive;
use behzadsp\Raid\RaidTen;
use behzadsp\Raid\RaidZero;

$drives = [
    new Drive('1TB', 'ssd', '61cf6218-f378-4c7b-8b81-c09e84a1a86f'),
    new Drive('1TB', 'ssd', 'c76bee9a-dce6-433c-acc3-b82947335dd2'),
    new Drive('1TB', 'ssd', '31125db2-6043-4955-818a-af9d259905eb'),
    new Drive('1TB', 'ssd', '302db7a1-bb2c-4fb9-a9e1-30636e8f312c'),
];

$raidTen = new RaidTen($drives);

echo $raidTen->getCapacity(); // 2199023255552
echo $raidTen->getCapacity(['human' => true]); // 2 TB

$raidZero = new RaidZero($drives);
echo $raidZero->getCapacity(); // 4398046511104
echo $raidZero->getCapacity(['human' => true]); // 4 TB

This library is most useful if you are doing some kind of inventory management already and are storing drives (SSD, HDD) into some kind of persistent RDBMS and would like to also start keeping persistent state of RAID in that system.

It's also a great jumping off point if you want to do something really cool like automate the configuration of hardware or software RAID in your datacenter/environment.

Documentation

Coming soon. For now see the tests.

Contribution

I welcome it and would appreciate it. Fork the repository and create a feature branch off the 'develop' branch and open a pull request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-05