File: CedarBackup2.actions.store-module.html

package info (click to toggle)
cedar-backup2 2.20.1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 20,636 kB
  • ctags: 34,592
  • sloc: python: 63,703; xml: 9,041; makefile: 100; sh: 9
file content (645 lines) | stat: -rw-r--r-- 29,199 bytes parent folder | download
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>CedarBackup2.actions.store</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="CedarBackup2-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://cedar-backup.sourceforge.net/">CedarBackup2</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="CedarBackup2-module.html">Package&nbsp;CedarBackup2</a> ::
        <a href="CedarBackup2.actions-module.html">Package&nbsp;actions</a> ::
        Module&nbsp;store
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="CedarBackup2.actions.store-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module store</h1><p class="nomargin-top"><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html">source&nbsp;code</a></span></p>
<p>Implements the standard 'store' action.</p>

<hr />
<div class="fields">      <dl><dt>Authors:</dt>
        <dd>
          Kenneth J. Pronovici &lt;pronovic@ieee.org&gt;,
          Dmitry Rutsky &lt;rutsky@inbox.ru&gt;
        </dd>
      </dl>
</div><!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#executeStore" class="summary-sig-name">executeStore</a>(<span class="summary-sig-arg">configPath</span>,
        <span class="summary-sig-arg">options</span>,
        <span class="summary-sig-arg">config</span>)</span><br />
      Executes the store backup action.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#executeStore">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#writeImage" class="summary-sig-name">writeImage</a>(<span class="summary-sig-arg">config</span>,
        <span class="summary-sig-arg">newDisc</span>,
        <span class="summary-sig-arg">stagingDirs</span>)</span><br />
      Builds and writes an ISO image containing the indicated stage 
      directories.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#writeImage">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#writeStoreIndicator" class="summary-sig-name">writeStoreIndicator</a>(<span class="summary-sig-arg">config</span>,
        <span class="summary-sig-arg">stagingDirs</span>)</span><br />
      Writes a store indicator file into staging directories.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#writeStoreIndicator">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#consistencyCheck" class="summary-sig-name">consistencyCheck</a>(<span class="summary-sig-arg">config</span>,
        <span class="summary-sig-arg">stagingDirs</span>)</span><br />
      Runs a consistency check against media in the backup device.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#consistencyCheck">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#writeImageBlankSafe" class="summary-sig-name">writeImageBlankSafe</a>(<span class="summary-sig-arg">config</span>,
        <span class="summary-sig-arg">rebuildMedia</span>,
        <span class="summary-sig-arg">todayIsStart</span>,
        <span class="summary-sig-arg">blankBehavior</span>,
        <span class="summary-sig-arg">stagingDirs</span>)</span><br />
      Builds and writes an ISO image containing the indicated stage 
      directories.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#writeImageBlankSafe">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#_getNewDisc" class="summary-sig-name" onclick="show_private();">_getNewDisc</a>(<span class="summary-sig-arg">writer</span>,
        <span class="summary-sig-arg">rebuildMedia</span>,
        <span class="summary-sig-arg">todayIsStart</span>,
        <span class="summary-sig-arg">blankBehavior</span>)</span><br />
      Gets a value for the newDisc flag based on blanking factor rules.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#_getNewDisc">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="CedarBackup2.actions.store-module.html#_findCorrectDailyDir" class="summary-sig-name" onclick="show_private();">_findCorrectDailyDir</a>(<span class="summary-sig-arg">options</span>,
        <span class="summary-sig-arg">config</span>)</span><br />
      Finds the correct daily staging directory to be written to disk.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#_findCorrectDailyDir">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="logger"></a><span class="summary-name">logger</span> = <code title="logging.getLogger(&quot;CedarBackup2.log.actions.store&quot;)">logging.getLogger(&quot;CedarBackup2.log.actions.store&quot;)</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="executeStore"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">executeStore</span>(<span class="sig-arg">configPath</span>,
        <span class="sig-arg">options</span>,
        <span class="sig-arg">config</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#executeStore">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Executes the store backup action.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>configPath</code></strong> (String representing a path on disk.) - Path to configuration file on disk.</li>
        <li><strong class="pname"><code>options</code></strong> (Options object.) - Program command-line options.</li>
        <li><strong class="pname"><code>config</code></strong> (Config object.) - Program configuration.</li>
    </ul></dd>
    <dt>Raises:</dt>
    <dd><ul class="nomargin-top">
        <li><code><strong class='fraise'>ValueError</strong></code> - Under many generic error conditions</li>
        <li><code><strong class='fraise'>IOError</strong></code> - If there are problems reading or writing files.</li>
    </ul></dd>
  </dl>
<div class="fields">      <strong>Notes:</strong>
      <ul class="nomargin-top">
        <li>
        The rebuild action and the store action are very similar.  The main
        difference is that while store only stores a single day's staging 
        directory, the rebuild action operates on multiple staging 
        directories.
        </li>
        <li>
        When the store action is complete, we will write a store indicator 
        to the daily staging directory we used, so it's obvious that the 
        store action has completed.
        </li>
      </ul>
</div></td></tr></table>
</div>
<a name="writeImage"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">writeImage</span>(<span class="sig-arg">config</span>,
        <span class="sig-arg">newDisc</span>,
        <span class="sig-arg">stagingDirs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#writeImage">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Builds and writes an ISO image containing the indicated stage 
  directories.</p>
  <p>The generated image will contain each of the staging directories 
  listed in <code>stagingDirs</code>.  The directories will be placed into 
  the image at the root by date, so staging directory 
  <code>/opt/stage/2005/02/10</code> will be placed into the disc at 
  <code>/2005/02/10</code>.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>config</code></strong> - Config object.</li>
        <li><strong class="pname"><code>newDisc</code></strong> - Indicates whether the disc should be re-initialized</li>
        <li><strong class="pname"><code>stagingDirs</code></strong> - Dictionary mapping directory path to date suffix.</li>
    </ul></dd>
    <dt>Raises:</dt>
    <dd><ul class="nomargin-top">
        <li><code><strong class='fraise'>ValueError</strong></code> - Under many generic error conditions</li>
        <li><code><strong class='fraise'>IOError</strong></code> - If there is a problem writing the image to disc.</li>
    </ul></dd>
  </dl>
<div class="fields">      <p><strong>Note:</strong>
        This function is implemented in terms of <a 
        href="CedarBackup2.actions.store-module.html#writeImageBlankSafe" 
        class="link">writeImageBlankSafe</a>.  The <code>newDisc</code> 
        flag is passed in for both <code>rebuildMedia</code> and 
        <code>todayIsStart</code>.
      </p>
</div></td></tr></table>
</div>
<a name="writeStoreIndicator"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">writeStoreIndicator</span>(<span class="sig-arg">config</span>,
        <span class="sig-arg">stagingDirs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#writeStoreIndicator">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Writes a store indicator file into staging directories.</p>
  <p>The store indicator is written into each of the staging directories 
  when either a store or rebuild action has written the staging directory 
  to disc.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>config</code></strong> - Config object.</li>
        <li><strong class="pname"><code>stagingDirs</code></strong> - Dictionary mapping directory path to date suffix.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="consistencyCheck"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">consistencyCheck</span>(<span class="sig-arg">config</span>,
        <span class="sig-arg">stagingDirs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#consistencyCheck">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Runs a consistency check against media in the backup device.</p>
  <p>It seems that sometimes, it's possible to create a corrupted 
  multisession disc (i.e. one that cannot be read) although no errors were 
  encountered while writing the disc.  This consistency check makes sure 
  that the data read from disc matches the data that was used to create the
  disc.</p>
  <p>The function mounts the device at a temporary mount point in the 
  working directory, and then compares the indicated staging directories in
  the staging directory and on the media.  The comparison is done via 
  functionality in <code>filesystem.py</code>.</p>
  <p>If no exceptions are thrown, there were no problems with the 
  consistency check.  A positive confirmation of &quot;no problems&quot; is
  also written to the log with <code>info</code> priority.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>config</code></strong> - Config object.</li>
        <li><strong class="pname"><code>stagingDirs</code></strong> - Dictionary mapping directory path to date suffix.</li>
    </ul></dd>
    <dt>Raises:</dt>
    <dd><ul class="nomargin-top">
        <li><code><strong class='fraise'>ValueError</strong></code> - If the two directories are not equivalent.</li>
        <li><code><strong class='fraise'>IOError</strong></code> - If there is a problem working with the media.</li>
    </ul></dd>
  </dl>
<div class="fields">      <p><strong>Warning:</strong>
        The implementation of this function is very UNIX-specific.
      </p>
</div></td></tr></table>
</div>
<a name="writeImageBlankSafe"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">writeImageBlankSafe</span>(<span class="sig-arg">config</span>,
        <span class="sig-arg">rebuildMedia</span>,
        <span class="sig-arg">todayIsStart</span>,
        <span class="sig-arg">blankBehavior</span>,
        <span class="sig-arg">stagingDirs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#writeImageBlankSafe">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Builds and writes an ISO image containing the indicated stage 
  directories.</p>
  <p>The generated image will contain each of the staging directories 
  listed in <code>stagingDirs</code>.  The directories will be placed into 
  the image at the root by date, so staging directory 
  <code>/opt/stage/2005/02/10</code> will be placed into the disc at 
  <code>/2005/02/10</code>.  The media will always be written with a media 
  label specific to Cedar Backup.</p>
  <p>This function is similar to <a 
  href="CedarBackup2.actions.store-module.html#writeImage" 
  class="link">writeImage</a>, but tries to implement a smarter blanking 
  strategy.</p>
  <p>First, the media is always blanked if the <code>rebuildMedia</code> 
  flag is true. Then, if <code>rebuildMedia</code> is false, blanking 
  behavior and <code>todayIsStart</code> come into effect:</p>
<pre class="literalblock">
  If no blanking behavior is specified, and it is the start of the week,
  the disc will be blanked

  If blanking behavior is specified, and either the blank mode is &quot;daily&quot;
  or the blank mode is &quot;weekly&quot; and it is the start of the week, then 
  the disc will be blanked if it looks like the weekly backup will not
  fit onto the media.

  Otherwise, the disc will not be blanked
</pre>
  <p>How do we decide whether the weekly backup will fit onto the media?  
  That is what the blanking factor is used for.  The following formula is 
  used:</p>
<pre class="literalblock">
  will backup fit? = (bytes available / (1 + bytes required) &lt;= blankFactor
</pre>
  <p>The blanking factor will vary from setup to setup, and will probably 
  require some experimentation to get it right.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>config</code></strong> - Config object.</li>
        <li><strong class="pname"><code>rebuildMedia</code></strong> - Indicates whether media should be rebuilt</li>
        <li><strong class="pname"><code>todayIsStart</code></strong> - Indicates whether today is the starting day of the week</li>
        <li><strong class="pname"><code>blankBehavior</code></strong> - Blank behavior from configuration, or <code>None</code> to use 
          default behavior</li>
        <li><strong class="pname"><code>stagingDirs</code></strong> - Dictionary mapping directory path to date suffix.</li>
    </ul></dd>
    <dt>Raises:</dt>
    <dd><ul class="nomargin-top">
        <li><code><strong class='fraise'>ValueError</strong></code> - Under many generic error conditions</li>
        <li><code><strong class='fraise'>IOError</strong></code> - If there is a problem writing the image to disc.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="_getNewDisc"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_getNewDisc</span>(<span class="sig-arg">writer</span>,
        <span class="sig-arg">rebuildMedia</span>,
        <span class="sig-arg">todayIsStart</span>,
        <span class="sig-arg">blankBehavior</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#_getNewDisc">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Gets a value for the newDisc flag based on blanking factor rules.</p>
  <p>The blanking factor rules are described above by <a 
  href="CedarBackup2.actions.store-module.html#writeImageBlankSafe" 
  class="link">writeImageBlankSafe</a>.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>writer</code></strong> - Previously configured image writer containing image entries</li>
        <li><strong class="pname"><code>rebuildMedia</code></strong> - Indicates whether media should be rebuilt</li>
        <li><strong class="pname"><code>todayIsStart</code></strong> - Indicates whether today is the starting day of the week</li>
        <li><strong class="pname"><code>blankBehavior</code></strong> - Blank behavior from configuration, or <code>None</code> to use 
          default behavior</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>newDisc flag to be set on writer.</dd>
  </dl>
</td></tr></table>
</div>
<a name="_findCorrectDailyDir"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_findCorrectDailyDir</span>(<span class="sig-arg">options</span>,
        <span class="sig-arg">config</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="CedarBackup2.actions.store-pysrc.html#_findCorrectDailyDir">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Finds the correct daily staging directory to be written to disk.</p>
  <p>In Cedar Backup v1.0, we assumed that the correct staging directory 
  matched the current date.  However, that has problems.  In particular, it
  breaks down if collect is on one side of midnite and stage is on the 
  other, or if certain processes span midnite.</p>
  <p>For v2.0, I'm trying to be smarter.  I'll first check the current day.
  If that directory is found, it's good enough.  If it's not found, I'll 
  look for a valid directory from the day before or day after <i>which has 
  not yet been staged, according to the stage indicator file</i>.  The 
  first one I find, I'll use.  If I use a directory other than for the 
  current day <i>and</i> <code>config.store.warnMidnite</code> is set, a 
  warning will be put in the log.</p>
  <p>There is one exception to this rule.  If the <code>options.full</code>
  flag is set, then the special &quot;span midnite&quot; logic will be 
  disabled and any existing store indicator will be ignored.  I did this 
  because I think that most users who run <code>cback --full store</code> 
  twice in a row expect the command to generate two identical discs.  With 
  the other rule in place, running that command twice in a row could result
  in an error (&quot;no unstored directory exists&quot;) or could even 
  cause a completely unexpected directory to be written to disc (if some 
  previous day's contents had not yet been written).</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>options</code></strong> - Options object.</li>
        <li><strong class="pname"><code>config</code></strong> - Config object.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>Correct staging dir, as a dict mapping directory to date suffix.</dd>
    <dt>Raises:</dt>
    <dd><ul class="nomargin-top">
        <li><code><strong class='fraise'>IOError</strong></code> - If the staging directory cannot be found.</li>
    </ul></dd>
  </dl>
<div class="fields">      <p><strong>Note:</strong>
        This code is probably longer and more verbose than it needs to be, 
        but at least it's straightforward.
      </p>
</div></td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="CedarBackup2-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://cedar-backup.sourceforge.net/">CedarBackup2</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Tue Oct 19 20:56:41 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>