ArangoDB2

 view release on metacpan or  search on metacpan

lib/ArangoDB2/Admin.pm  view on Meta::CPAN

# GET /_admin/time
sub time
{
    my($self) = @_;
    # make request
    return $self->arango->http->get('/_admin/time');
}

# walFlush
#
# PUT /_admin/wal/flush
sub walFlush
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['waitForSync', 'waitForCollector']);
    # make request
    return $self->arango->http->put('/_admin/wal/flush', $args);
}

# walProperties
#
# GET /_admin/wal/properties
# PUT /_admin/wal/properties
sub walProperties
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, [qw(
        allowOversizeEntries logfileSize historicLogfiles
        reserveLogfiles throttleWait throttleWhenPending
    )]);
    # request path
    my $path = '/_admin/wal/properties';

lib/ArangoDB2/Admin.pm  view on Meta::CPAN

    tests

=item time

GET /_admin/time

The call returns an object with the attribute time.

=item walFlush

PUT /_admin/wal/flush

Flushes the write-ahead log.

Parameters:

    waitForSync
    waitForCollector

=item walProperties

GET /_admin/wal/properties
PUT /_admin/wal/properties

Configures the behavior of the write-ahead log.

Parameters:

    allowOversizeEntries
    logfileSize
    historicLogfiles
    reserveLogfiles
    throttleWait

lib/ArangoDB2/Collection.pm  view on Meta::CPAN

    $args = $self->_build_args($args, ['excludeSystem']);
    # make request
    return $self->arango->http->get(
        $self->api_path('collection'),
        $args,
    );
}

# load
#
# PUT /_api/collection/{collection-name}/load
sub load
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['count']);
    # make request
    return $self->arango->http->put(
        $self->api_path('collection', $self->name, 'load'),
        $args,
    );

lib/ArangoDB2/Collection.pm  view on Meta::CPAN

#
# get/set numberOfShards
sub numberOfShards { shift->_get_set('numberOfShards', @_) }

# properties
#
# GET /_api/collection/{collection-name}/properties
#
# or
#
# PUT /_api/collection/{collection-name}/properties
sub properties
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['journalSize', 'waitForSync']);
    # build path
    my $path = $self->api_path('collection', $self->name, 'properties');
    # make request
    my $res = %$args
        # if args are passed then set with PUT
        ? $self->arango->http->put($path, undef, $JSON->encode($args))
        # otherwise get properties
        : $self->arango->http->get($path);
    # copy response data to instance
    $self->_build_self($res, \@PARAMS);

    return $self;
}

# rename
#
# PUT /_api/collection/{collection-name}/rename
sub rename
{
    my($self, $args) = @_;
    # make a copy of current name
    my $old_name = $self->name;
    # process args
    $args = $self->_build_args($args, ['name']);

    my $res = $self->arango->http->put(
        $self->api_path('collection', $self->name, 'rename'),

lib/ArangoDB2/Collection.pm  view on Meta::CPAN

{
    my($self) = @_;

    return $self->arango->http->get(
        $self->api_path('collection', $self->name, 'revision'),
    );
}

# rotate
#
# PUT /_api/collection/{collection-name}/rotate
sub rotate
{
    my($self) = @_;

    return $self->arango->http->put(
        $self->api_path('collection', $self->name, 'rotate'),
    );
}

# shardKeys
#
# get/set shardKeys
sub shardKeys { shift->_get_set('shardKeys', @_) }

# truncate
#
# PUT /_api/collection/{collection-name}/truncate
sub truncate
{
    my($self) = @_;

    return $self->arango->http->put(
        $self->api_path('collection', $self->name, 'truncate'),
    );
}

# type
#
# get/set type
sub type { shift->_get_set('type', @_) }

# unload
#
# PUT /_api/collection/{collection-name}/unload
sub unload
{
    my($self) = @_;

    return $self->arango->http->put(
        $self->api_path('collection', $self->name, 'unload'),
    );
}

# waitForSync

lib/ArangoDB2/Cursor.pm  view on Meta::CPAN

# get fullCount for LIMIT result
sub fullCount
{
    my($self) = @_;

    return $self->data && $self->data->{extra} && $self->data->{extra}->{fullCount};
}

# get
#
# PUT /_api/cursor/{cursor-identifier}
#
# get next batch of results from api
sub get
{
    my($self) = @_;
    # need data
    return unless $self->data
        and $self->data->{hasMore};
    # request next batch
    my $res = $self->arango->http->put(

lib/ArangoDB2/Document.pm  view on Meta::CPAN

    return $self;
}

# policy
#
# get/set policy
sub policy { shift->_get_set('policy', @_) }

# replace
#
# PUT /_api/document/{document-handle}
sub replace
{
    my($self, $data, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['policy', 'waitForSync']);
    # make request
    my $res = $self->arango->http->put(
        $self->api_path($self->_class, $self->collection->name, $self->name),
        $args,
        $JSON->encode($data),

lib/ArangoDB2/Graph/EdgeDefinition.pm  view on Meta::CPAN


    my $res = $self->arango->http->get(
        $self->api_path('gharial', $self->graph->name, 'edge')
    ) or return;

    return $res->{collections};
}

# replace
#
# PUT /_api/gharial/graph-name/edge/definition-name
sub replace
{
    my($self, $args) = @_;
    # process request args
    $args = $self->_build_args($args, ['from', 'name', 'to']);
    # copy name to collection
    my $name = $args->{collection} = delete $args->{name};
    # make request
    my $res = $self->arango->http->put(
        $self->api_path('gharial', $self->graph->name, 'edge', $self->name),

lib/ArangoDB2/Graph/Vertex.pm  view on Meta::CPAN

    }
    # register object
    my $register = $self->_register;
    $self->collection->$register->{$self->name} = $self;

    return $self;
}

# replace
#
# PUT /system/gharial/graph-name/vertex/collection-name/vertex-key
sub replace
{
    my($self, $data, $args) = @_;
    # require data
    die "Invlalid args"
        unless ref $data eq 'HASH';
    # process args
    $args = $self->_build_args($args, ['name', 'waitForSync']);
    # make request
    my $res = $self->arango->http->put(

lib/ArangoDB2/HTTP/Curl.pm  view on Meta::CPAN

# the path and any args passed
sub patch
{
    my($self, $path, $args, $data, $raw) = @_;

    return $self->curl("PATCH", $path, $args, $data, $raw);
}

# put
#
# make a PUT request using the ArangoDB API uri along with
# the path and any args passed
sub put
{
    my($self, $path, $args, $data, $raw) = @_;

    return $self->curl("PUT", $path, $args, $data, $raw);
}

# post
#
# make a POST request using the ArangoDB API uri along with
# the path and any args passed
sub post
{
    my($self, $path, $args, $data, $raw) = @_;

lib/ArangoDB2/HTTP/LWP.pm  view on Meta::CPAN

    # make request
    my $response = $self->lwp->request($request);
    # do not process response if raw requested
    return $response if $raw;
    # process response
    return $self->response($response);
}

# put
#
# make a PUT request using the ArangoDB API uri along with
# the path and any args passed
sub put
{
    my($self, $path, $args, $put, $raw) = @_;
    # get copy of ArangoDB API URI
    my $uri = $self->arango->uri->clone;
    # set path for request
    $uri->path($path);
    # set query params on URI if passed
    $uri->query_form($args) if $args;

lib/ArangoDB2/Replication.pm  view on Meta::CPAN




###############
# API METHODS #
###############

# applierConfig
#
# GET /_api/replication/applier-config
# PUT /_api/replication/applier-config
sub applierConfig
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['configuration']);
    # build path
    my $path = $self->api_path('replication', 'applier-config');
    # make request
    return $args->{configuration}
        ? $self->arango->http->put($path, $args)
        : $self->arango->http->get($path);
}

# applierStart
#
# PUT /_api/replication/applier-start
sub applierStart
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['from']);
    # make request
    return $self->arango->http->put(
        $self->api_path('replication', 'applier-start'),
        $args,
    );

lib/ArangoDB2/Replication.pm  view on Meta::CPAN

{
    my($self) = @_;
    # make request
    return $self->arango->http->get(
        $self->api_path('replication', 'applier-state'),
    );
}

# applierStop
#
# PUT /_api/replication/applier-stop
sub applierStop
{
    my($self) = @_;
    # make request
    return $self->arango->http->get(
        $self->api_path('replication', 'applier-stop'),
    );
}

# clusterInventory

lib/ArangoDB2/Replication.pm  view on Meta::CPAN

{
    my($self) = @_;
    # make request
    return $self->arango->http->get(
        $self->api_path('replication', 'server-id'),
    );
}

# sync
#
# PUT /_api/replication/sync
sub sync
{
    my($self, $args) = @_;
    # process args
    $args = $self->_build_args($args, ['configuration']);
    # make request
    return $self->arango->http->put(
        $self->api_path('replication', 'sync'),
        $args,
    );

lib/ArangoDB2/Replication.pm  view on Meta::CPAN


=head1 DESCRIPTION

=head1 API METHODS

=over 4

=item applierConfig

GET /_api/replication/applier-config
PUT /_api/replication/applier-config

Returns the configuration of the replication applier or sets the configuration of the replication applier.

Parameters:

    configuration

=item applierStart

PUT /_api/replication/applier-start

Starts the replication applier.

Parameters:

    from

=item applierState

GET /_api/replication/applier-state

Returns the state of the replication applier, regardless of whether the applier is currently running or not.

=item applierStop

PUT /_api/replication/applier-stop

Stops the replication applier.



=item clusterInventory

GET /_api/replication/clusterInventory

Returns the list of collections and indexes available on the cluster.

lib/ArangoDB2/Replication.pm  view on Meta::CPAN

Returns the current state of the server's replication logger.

=item serverId

GET /_api/replication/server-id

Returns the servers id. The id is also returned by other replication API methods, and this method is an easy means of determining a server's id.

=item sync

PUT /_api/replication/sync

Starts a full data synchronization from a remote endpoint into the local ArangoDB database.

Parameters:

    configuration

=back

=head1 PROPERTY METHODS

lib/ArangoDB2/User.pm  view on Meta::CPAN

        $JSON->encode($args),
    ) or return;
    # if request was success copy args to self
    $self->_build_self($res, \@PARAMS);

    return $self;
}

# replace
#
# PUT /_api/user/{user}
sub replace
{
    my($self, $args) = @_;
    # process request args
    $args = $self->_build_args($args, \@PARAMS);
    # make request
    my $res = $self->arango->http->put(
        $self->api_path('user', delete $args->{name}),
        undef,
        $JSON->encode($args),

lib/ArangoDB2/User.pm  view on Meta::CPAN


Parameters:
    active
    changePassword
    extra
    name
    passwd

=item replace

PUT /_api/user/{user}

Replaces the data of an existing user.

Parameters:
    active
    changePassword
    extra
    name
    passwd



( run in 0.401 second using v1.01-cache-2.11-cpan-4e96b696675 )