aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm61
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm
index c2977fe6..b6f5a3d8 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm
@@ -211,6 +211,26 @@ class_has '+type' => (
default => 'PartitionTable'
);
+class_has '+restrictions' => (
+ default => sub {
+ return {
+ child => sub {
+ my $self = shift;
+ my $part = shift;
+ return $part->isa('ManaTools::Shared::disk_backend::Part::PartitionElement');
+ },
+ parent => sub {
+ my $self = shift;
+ my $part = shift;
+ return $part->does('ManaTools::Shared::disk_backend::BlockDevice');
+ },
+ sibling => sub { return 0; },
+ previous => sub { return 0; },
+ next => sub { return 0; },
+ }
+ }
+);
+
class_has '+in_restriction' => (
default => sub {
return sub {
@@ -245,4 +265,45 @@ class_has '+out_restriction' => (
}
);
+package ManaTools::Shared::disk_backend::Part::PartitionElement;
+
+use Moose;
+
+extends 'ManaTools::Shared::disk_backend::Part';
+
+with 'ManaTools::Shared::disk_backend::BlockDevice';
+
+use MooseX::ClassAttribute;
+
+class_has '+type' => (
+ default => 'PartitionElement'
+);
+
+class_has '+restrictions' => (
+ default => sub {
+ return {
+ parent => sub {
+ my $self = shift;
+ my $part = shift;
+ return $part->isa('ManaTools::Shared::disk_backend::Part::PartitionTable');
+ },
+ sibling => sub {
+ my $self = shift;
+ my $part = shift;
+ return $part->isa('ManaTools::Shared::disk_backend::Part::PartitionElement');
+ },
+ previous => sub {
+ my $self = shift;
+ my $part = shift;
+ return $part->isa('ManaTools::Shared::disk_backend::Part::PartitionElement');
+ },
+ next => sub {
+ my $self = shift;
+ my $part = shift;
+ return $part->isa('ManaTools::Shared::disk_backend::Part::PartitionElement');
+ },
+ }
+ }
+);
+
1;