<commit_before>package Ravada::Front::Domain;

use warnings;
use strict;

=head2 NAME

Ravada::Front::Domain - Frontent domain information for Ravada

=cut

use Carp qw(cluck confess croak);
use JSON::XS;
use Moose;

no warnings "experimental::signatures";
use feature qw(signatures);

with 'Ravada::Domain';

###########################################################################
#
has 'readonly' => (
    isa => 'Int'
    ,is => 'ro'
    ,default => 1
);

our $CONNECTOR = \$Ravada::Front::CONNECTOR;
#
###########################################################################

sub BUILD($self, $arg) {
    my $id = $arg->{id} or confess "ERROR: id required";
    my $ret = $self->_select_domain_db( id => $id);

    confess "ERROR: Domain '".$self->name." not found "
        if $self->is_volatile && ! $self->is_active;
}

sub autostart($self )    { return $self->_data('autostart') }
sub _do_force_shutdown  { confess "TODO" }
sub add_volume          { confess "TODO" }
sub clean_swap_volumes  { confess "TODO" }<commit_msg>[#628] allow open a down volatile domain<commit_after>package Ravada::Front::Domain;

use warnings;
use strict;

=head2 NAME

Ravada::Front::Domain - Frontent domain information for Ravada

=cut

use Carp qw(cluck confess croak);
use JSON::XS;
use Moose;

no warnings "experimental::signatures";
use feature qw(signatures);

with 'Ravada::Domain';

###########################################################################
#
has 'readonly' => (
    isa => 'Int'
    ,is => 'ro'
    ,default => 1
);

our $CONNECTOR = \$Ravada::Front::CONNECTOR;
#
###########################################################################

sub BUILD($self, $arg) {
    my $id = $arg->{id} or confess "ERROR: id required";
    my $ret = $self->_select_domain_db( id => $id);

#    confess "ERROR: Domain '".$self->name." not found "
#        if $self->is_volatile && ! $self->is_active;
}

sub open($self, $id) {
    return Ravada::Front::Domain->new( id => $id );
}

sub autostart($self )    { return $self->_data('autostart') }
sub _do_force_shutdown  { confess "TODO" }
sub add_volume          { confess "TODO" }
sub clean_swap_volumes  { confess "TODO" }
{'fraction_non_alphanumeric': 0.2781092244148692, 'fraction_numerical': 0.0032124827902707664, 'mean_word_length': 4.677083333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1330088', 'n_tokens_mistral': 722, 'n_tokens_neox': 691, 'n_words': 181}