Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
f12b73bc
Commit
f12b73bc
authored
13 years ago
by
Yuriy Nevinitsin
Browse files
Options
Downloads
Plain Diff
Merge branch 'perl-iproto-async'
parents
f5c82683
e9f6ed35
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
connector/perl/lib/MR/IProto.pm
+20
-0
20 additions, 0 deletions
connector/perl/lib/MR/IProto.pm
connector/perl/lib/MR/IProto/Cluster/Server.pm
+35
-0
35 additions, 0 deletions
connector/perl/lib/MR/IProto/Cluster/Server.pm
with
55 additions
and
0 deletions
connector/perl/lib/MR/IProto.pm
+
20
−
0
View file @
f12b73bc
...
...
@@ -67,6 +67,14 @@ Or asynchronously:
$client->send($request, $callback);
# callback is called when reply is received or error is occured
It is recommended to disconnect all connections in child after fork() to
prevent possible conflicts:
my $pid = fork();
if ($pid == 0) {
MR::IProto->disconnect_all();
}
=head1 DESCRIPTION
This client is used to communicate with cluster of balanced servers using
...
...
@@ -334,6 +342,18 @@ sub SetTimeout {
return
;
}
=item disconnect_all
Class method used to disconnect all iproto-connections. Very useful in case of fork().
=cut
sub
disconnect_all
{
my
(
$class
)
=
@_
;
MR::IProto::Cluster::
Server
->
disconnect_all
();
return
;
}
=back
=head1 PROTECTED METHODS
...
...
This diff is collapsed.
Click to expand it.
connector/perl/lib/MR/IProto/Cluster/Server.pm
+
35
−
0
View file @
f12b73bc
...
...
@@ -12,6 +12,7 @@ This class is used to implement all communication with one server.
use
Mouse
;
use
Mouse::Util::
TypeConstraints
;
use
Scalar::
Util
;
use
MR::IProto::Connection::
Async
;
use
MR::IProto::Connection::
Sync
;
use
MR::IProto::
Message
;
...
...
@@ -170,14 +171,48 @@ has sync => (
lazy_build
=>
1
,
);
my
%servers
;
=back
=head1 PUBLIC METHODS
=over
=item disconnect_all
Class method used to disconnect all iproto-connections. Very useful in case of fork().
=cut
sub
disconnect_all
{
my
(
$class
)
=
@_
;
foreach
my
$server
(
values
%servers
)
{
$server
->
clear_async
();
$server
->
clear_sync
();
}
return
;
}
=head1 PROTECTED METHODS
=over
=cut
sub
BUILD
{
my
(
$self
)
=
@_
;
$servers
{
Scalar::Util::
refaddr
(
$self
)}
=
$self
;
Scalar::Util::
weaken
(
$servers
{
Scalar::Util::
refaddr
(
$self
)});
return
;
}
sub
DEMOLISH
{
my
(
$self
)
=
@_
;
delete
$servers
{
Scalar::Util::
refaddr
(
$self
)};
return
;
}
sub
_build_async
{
my
(
$self
)
=
@_
;
return
MR::IProto::Connection::
Async
->
new
(
server
=>
$self
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment