Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
82d0ed9b
Commit
82d0ed9b
authored
Feb 19, 2016
by
Leigh B Stoller
Browse files
Add common Flush() code, so that we can get all the caches in one call.
parent
129defe2
Changes
12
Hide whitespace changes
Inline
Side-by-side
db/BlockstoreType.pm
View file @
82d0ed9b
#!/usr/bin/perl -wT
#
# Copyright (c) 2012,2013 University of Utah and the Flux Group.
# Copyright (c) 2012,2013
,2016
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -38,6 +38,7 @@ use overload ('""' => 'Stringify');
# Cache of instances to avoid regenerating them.
my
%bstypes
=
();
BEGIN
{
use
emutil
;
emutil::
AddCache
(
\
%bstypes
);
}
my
$debug
=
0
;
# Little helper and debug function.
...
...
db/Experiment.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2005
-
201
5
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
201
6
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -227,6 +227,7 @@ $EXPT_RESOURCESHOSED = 0;
#
Cache
of
instances
to
avoid
regenerating
them
.
%
experiments
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
experiments
);
}
#
Little
helper
and
debug
function
.
sub
mysystem
($)
...
...
db/Group.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2005
-
201
5
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
201
6
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -54,6 +54,7 @@ my $MIN_UNIX_GID = @MIN_UNIX_GID@;
#
Cache
of
instances
to
avoid
regenerating
them
.
my
%
groups
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
groups
);
}
my
$
debug
=
0
;
#
MemberList
flags
.
...
...
db/Interface.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2005
-
2014
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
2014
,
2016
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -44,6 +44,9 @@ my $BOSSNODE = "@BOSSNODE@";
#
Cache
of
instances
to
avoid
regenerating
them
.
my
%
all_interfaces
=
();
my
%
node_interfaces
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
all_interfaces
);
emutil
::
AddCache
(\%
node_interfaces
);
}
#
Manual
my
$
debug
=
0
;
...
...
db/Lan.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2007
-
201
5
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2007
-
201
6
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -52,6 +52,7 @@ my $TBOPS = "@TBOPSEMAIL@";
# Cache of instances to avoid regenerating them.
my %lans = ();
BEGIN { use emutil; emutil::AddCache(\%lans); }
my $debug = 0;
sub debugging() {return $debug; }
...
...
@@ -1397,6 +1398,7 @@ use overload ('""' => 'Stringify');
# Cache of instances to avoid regenerating them.
my %members = ();
BEGIN { use emutil; emutil::AddCache(\%members); }
#
# Lookup and create a class instance to return.
...
...
@@ -1671,6 +1673,7 @@ use overload ('""' => 'Stringify');
# Cache of instances to avoid regenerating them.
my %interfaces = ();
BEGIN { use emutil; emutil::AddCache(\%interfaces); }
# accessors
sub field($$) { return ((! ref($_[0])) ? -1 : $_[0]->{'
IFACE
'}->{$_[1]}); }
...
...
@@ -2438,6 +2441,7 @@ my $SNMPIT = "$TB/bin/snmpit";
# Cache of instances to avoid regenerating them.
my %vlans = ();
BEGIN { use emutil; emutil::AddCache(\%vlans); }
#
# Lookup and create a class instance to return.
...
...
@@ -3746,6 +3750,7 @@ use overload ('""' => 'Stringify');
# Cache of instances to avoid regenerating them.
my %tunnels = ();
BEGIN { use emutil; emutil::AddCache(\%tunnels); }
#
# Lookup and create a class instance to return.
...
...
db/Node.pm.in
View file @
82d0ed9b
...
...
@@ -64,6 +64,7 @@ $NODEROLE_TESTNODE = 'testnode';
#
Cache
of
instances
to
avoid
regenerating
them
.
%
nodes
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
nodes
);
}
#
Little
helper
and
debug
function
.
sub
mysystem
($)
...
...
db/NodeType.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2005
-
2014
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
2014
,
2016
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -43,6 +43,10 @@ my $BOSSNODE = "@BOSSNODE@";
#
Cache
of
instances
to
avoid
regenerating
them
.
my
%
nodetypes
=
();
my
%
nodeclasses
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
nodetypes
);
emutil
::
AddCache
(\%
nodeclasses
);
}
my
$
debug
=
0
;
#
Little
helper
and
debug
function
.
...
...
db/Project.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2005
-
201
5
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
201
6
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -55,6 +55,8 @@ my $ADDPROJADMINLIST = "$TB/sbin/addprojadminlist";
#
Cache
of
instances
to
avoid
regenerating
them
.
my
%
projects
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
projects
);
}
my
$
debug
=
0
;
#
Little
helper
and
debug
function
.
...
...
db/Quota.pm
View file @
82d0ed9b
#!/usr/bin/perl -wT
#
# Copyright (c) 2012-201
5
University of Utah and the Flux Group.
# Copyright (c) 2012-201
6
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -47,6 +47,7 @@ my $UNLIMITED = -1;
# cache of instances to avoid regenerating them.
my
%quotas
=
();
BEGIN
{
use
emutil
;
emutil::
AddCache
(
\
%quotas
);
}
my
$debug
=
0
;
# Little helper and debug function.
...
...
db/User.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2005
-
201
5
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
201
6
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -387,6 +387,22 @@ sub LookupNonLocal($$)
return
User
->
Lookup
($
uid_idx
);
}
#
#
Flush
from
our
little
cache
.
#
sub
Flush
($)
{
my
($
self
)
=
@
_
;
delete
($
users
{$
self
->
uid_idx
()});
}
sub
FlushAll
($)
{
my
($
class
)
=
@
_
;
%
users
=
();
}
#
#
Class
function
to
create
new
user
and
return
object
.
#
...
...
db/VirtExperiment.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -wT
#
#
Copyright
(
c
)
2009
-
2014
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2009
-
2014
,
2016
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -64,6 +64,7 @@ my $TBOPS = "@TBOPSEMAIL@";
#
Cache
of
instances
to
avoid
regenerating
them
.
my
%
virtexperiments
=
();
BEGIN
{
use
emutil
;
emutil
::
AddCache
(\%
virtexperiments
);
}
my
$
debug
=
0
;
#
...
...
db/emutil.pm.in
View file @
82d0ed9b
#
!/usr/bin/perl -w
#
#
Copyright
(
c
)
2000
-
201
5
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
201
6
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -45,6 +45,24 @@ use Time::Local;
#
Configure
variables
.
my
$
TB
=
"@prefix@"
;
#
#
Store
up
the
list
of
caches
to
flush
#
my
@
ourcaches
=
();
sub
AddCache
($)
{
my
($
ref
)
=
@
_
;
push
(@
ourcaches
,
$
ref
);
}
sub
FlushCaches
()
{
foreach
my
$
ref
(@
ourcaches
)
{
%$
ref
=
();
}
}
#
#
Support
for
checking
field
values
against
what
is
specified
.
#
...
...
@@ -883,5 +901,6 @@ sub waitForMount($;$)
return -1;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment