許家瑋
and 1 contributors

NAME

HTTP::Balancer::Model - the base class of models of HTTP::Balancer

SYNOPSIS

    package HTTP::Balancer::Model::Foo;
    use Modern::Perl;

    use Moose;
    extends qw(HTTP::Balancer::Model);

    use MoooseX::Storage;
    with Storage(format => 'YAML', io => 'File');

FUNCTIONS AND METHODS

models

returns the list of last name of HTTP::Balancer::Model::*

model_name

class method and instance method

returns lowercase of last name of current model

model_dir

class method and instance method

returns the directory store the entities of current model

path

instance method

returns the path for storing current object

glob

class method

returns all entities stored in model_dir, sorted with id.

save

instance method

save current object into model_dir, named as its id.

generate auto-incremented id for new object not on disk yet.

all(\&closure)

class method

returns all object restored from disk

call \&closure on each instance if given.

find($attr => $value)

class method

returns the first object satisfying the condition from disk.

where($attr => $value)

class method

returns all objects satisfying the condition from disk

remove

remove the instance from disk.

columns

list names of all columns of current Model.

slice(@columns)

returns attributes slice