NAME

Couch::DB::Node - represent a node in the cluster

SYNOPSIS

my $node = $couch->node('node1@127.0.0.1');
my $node = $client->node;

# Internal use only
my $node = Couch::DB::Node->new(name => $name, couch => $couch);

DESCRIPTION

This represents a Node in the database cluster. When this object is created, it may very well be that there is no knowledge about the node yet.

METHODS

Constructors

Couch::DB::Node->new(%options)
-Option--Default
 couch   <required>
 name    <required>
couch => Couch::DB-object
name => STRING

Accessors

$obj->couch()
$obj->name()

Node information

All CouchDB API calls documented below, support %options like _delay and on_error. See "Using the CouchDB API" in Couch::DB.

$obj->config(%options)
[CouchDB API "GET /_node/{node-name}/_config", UNTESTED]
[CouchDB API "GET /_node/{node-name}/_config/{section}", UNTESTED]
[CouchDB API "GET /_node/{node-name}/_config/{section}/{key}", UNTESTED]

Returns the node configuration.

At least according to the example in the spec, all values are strings. So, a boolean will be string "true" or "false". The API notes that the actual type of values is unpredictable.

-Option --Default
 key      undef
 section  undef
key => STRING

(Requires a section to be specified)

section => STRING

example: of config

# Three times the same.  The last may be the most efficient for the server.
my $mode = $node->config->values->{log}{level};
my $mode = $node->config(section => 'log')->values->{level};
my $mode = $node->config(section => 'log', key => 'level')->values;
$obj->configChange($section, $key, $value, %options)
[CouchDB API "PUT /_node/{node-name}/_config/{section}/{key}", UNTESTED]>

Change one value in the configuration. Probably, it should be followed by a configReload(): changes may not be commited without reload.

You MAY need to convert booleans to string "true" or "false" by hand.

$obj->configDelete($section, $key, %options)
[CouchDB API "DELETE /_node/{node-name}/_config/{section}/{key}", UNTESTED]>

Remove one value in the configuration. Probably, it should be followed by a configReload(): changes may not be commited without reload.

$obj->configReload(%options)
[CouchDB API "POST /_node/{node-name}/_config/_reload", UNTESTED]>

Re-apply the configuration to the node. This has as side-effect that the (changed) configuration of the node will be saved.

$obj->restart(%options)
[CouchDB API "POST /_node/{node-name}/_restart", UNTESTED]

This may help you in a test environment, but should not be used in production, according to the API documentation.

$obj->server(%options)
[CouchDB API "GET /_node/{node-name}/_system", UNTESTED]

Presents information about the system of the server where the node runs on.

Be aware that the method is called server, not system to avoid confusion with the local system and Perl's system function.

$obj->software(%options)
[CouchDB API "GET /_node/{node-name}/_versions", UNTESTED]

Get details of some software running the node.

$obj->stats(%options)
[CouchDB API "GET /_node/{node-name}/_stats", UNTESTED]

Collect node statistics.

SEE ALSO

This module is part of Couch-DB distribution version 0.006, built on September 09, 2024. Website: http://perl.overmeer.net/CPAN/

LICENSE

Copyrights 2024 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/