This file is indexed.

/usr/share/perl5/SyncUtil/localDB.pm is in syncbbdb 2.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#------------------------------------------------------------------------------
#   $Date: 2001/11/04 13:17:57 $
#   RCS: $Id: localDB.pm,v 1.1.1.1 2001/11/04 13:17:57 tdeweese Exp $
#------------------------------------------------------------------------------

package localDB;

use strict;

sub new {
  my $type = shift;
  my $self = {};
  bless ($self, $type);

  $self->{'host'} = shift;
  $self->{'last-time'} = 0;

  $self->{'fast'}    = "";
  $self->{'pilotDB'} = "";

  return $self;
}

sub getHost {
  my $self = shift;
  return $self->{'host'};
}

sub update {
  my $self = shift;
  my $ctime = time();
  # at least once a second give host some time...
  if ($self->{'last-time'} != $ctime)
    {
      $self->{'host'}->update();
      $self->{'last-time'} = $ctime;
    }
}

##############################################################################
###
###  This section contains methods that all subclasses MUST implement.
###
##############################################################################


sub getNew {
  my $self = shift;
  die ("Subclass must implement getNew to return a list of records that\n" .
       "are new in this database. Often this simply returns a list\n" .
       "constructed in setup.");
}

sub getMod {
  my $self = shift;
  die ("Subclass must implement getMod to return a list of records that\n" .
       "have been modified in this database. Often this simply returns a\n" .
       "list constructed in setup.");
}

sub getDel {
  my $self = shift;

  die ("Subclass must implement getDel to return a list of records that\n" .
       "have been delete from this database. Often this simply returns a\n" .
       "list constructed in setup.");
}

sub getRec {
  my $self = shift;
  my $id   = shift;
  die ("Subclass must implement this method to return the record with\n" .
       "the Pilot id requested or undef if not available.");
}

sub getPilotIDs {
  my $self = shift;
  my $rec  = shift;

  die ("Subclass must implement getPilotInfo to return the list of pilot-ids" .
       " associated with this record.");
}

sub dupRec {
  my $self = shift;
  my $rec  = shift;

  die ("Subclass must implement dupRec to copy $rec and return the\n"    .
       "copy.  Care must be taken to clear the associated pilot-id in\n" .
       "the new record");
}

sub syncRec {
  my $self      = shift;
  my $other_rec = shift;
  my $this_rec = shift;
  
  die ("Subclass must implement syncRec to merge contents of other_rec\n".
       "into this_rec (may be undef in which case create a new record).");
}

sub lastSyncDate {
  my $self = shift;

  # Example from lodalHashDB:
  # return $self->{'hashObj'}->syncDate();
  die ("Subclass must implement lastSyncDate to return the 'thisSyncDate'\n".
       "From the last sync that you think succeeded.\n");
}

##############################################################################
###
###  This section contains methods that many subclasses may want to 
###  override.
###
##############################################################################


sub name {
  my $self = shift;
  return "local";
}

sub output {
  my $self = shift;
  my $rec  = shift;

  ## Subclasses should really implement this to output a human
  ## readable one line description of rec.

  ## output the pilot record id if nothing else...
  $self->getHost()->output(join(", ", @{$self->getPilotIDs($rec)}) . "\n");
}

##############################################################################
###
###  This section contains methods that many subclasses may want to
###  augment. You need to call the base classes version of these
###  methods as well. Example:
###
###   $self->localDB::setup($fast, $pilotDB).
###
##############################################################################

sub setup {
  my $self = shift;

  $self->{'fast'}    = shift;
  $self->{'pilotDB'} = shift;
}

sub finish {
  my $self = shift;
  # Don't have anything to do but subclasses might override this
}


1;