/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Properties
DybPython::dbsvn::DBIValidate Class Reference

List of all members.

Public Member Functions

def __init__
def validate_msg
def validate_update
def validate_validity
def validate_hunk
def dump_diff
def __call__

Public Attributes

 diff
 msg
 author
 opts
 tabledict
 vlds

Properties

 tables = property(lambda self:[c.name for c in self.diff.children])
 exts = property(lambda self:[c.ext for c in self.diff.children])

Detailed Description

Basic validation of commit that represents an intended DB update

Definition at line 379 of file dbsvn.py.


Constructor & Destructor Documentation

def DybPython::dbsvn::DBIValidate::__init__ (   self,
  diff,
  msg,
  author,
  opts 
)

Definition at line 383 of file dbsvn.py.

00384                                                  :
00385          self.diff = diff
00386          self.msg = msg
00387          self.author = author
00388          self.opts = opts
00389 
00390          self.tabledict = dict([(c.name,c.smry) for c in self.diff.children])
00391          log_.debug("DBIValidate %r " % self.tabledict )
00392 


Member Function Documentation

def DybPython::dbsvn::DBIValidate::validate_msg (   self)

Definition at line 396 of file dbsvn.py.

00397                           :
00398         pass

def DybPython::dbsvn::DBIValidate::validate_update (   self)
Current checks do not verify tail addition  

Definition at line 399 of file dbsvn.py.

00400                               :
00401         """
00402         Current checks do not verify tail addition  
00403         """
00404         tdict = self.tabledict 
00405         tabs = tdict.keys()
00406         #print tabs
00407         #print tdict
00408 
00409         assert 'LOCALSEQNO' in tabs, "No LOCALSEQNO in %s " % tabs
00410         assert tdict['LOCALSEQNO'] not in ("-","",), "Unexpected LOCALSEQNO change %r " % tdict 
00411 
00412         tabs = filter(lambda t:t != 'LOCALSEQNO', tabs )
00413         vlds = filter( lambda t:t[-3:] == 'Vld' , tabs )
00414 
00415         if self.opts['decoupled']:
00416             pass
00417             #decoupled usage results in tmp_offline_db.cat deletions  
00418         else:  
00419             assert len(tabs) > 0,"No changed tables .. make sure are using lastest db.py and use consistent table selection  "
00420             assert len(tabs) % 2 == 0 , "An even number of changed tables is required %r " % tabs
00421             assert len(vlds) == len(tabs)/2 , "Need equal number of payload and validity table changes "
00422         pays = []
00423         for vld in vlds:
00424             pay = vld[:-3]
00425             assert pay in tabs, "Vld table %s is not paired " % vld 
00426             pays.append(pay)
00427         self.vlds = vlds 
00428 

def DybPython::dbsvn::DBIValidate::validate_validity (   self)
Checks on the validity contextrange of updates, to verify:

#. Presence of valid dates in all four DBI date slots  
#. Overlay versioning compliance, namely appropriate correspondence between TIMESTART and VERSIONDATE
      

Definition at line 429 of file dbsvn.py.

00430                                  :
00431         """
00432         Checks on the validity contextrange of updates, to verify:
00433 
00434         #. Presence of valid dates in all four DBI date slots  
00435         #. Overlay versioning compliance, namely appropriate correspondence between TIMESTART and VERSIONDATE
00436       
00437         """
00438         for delta in self.diff.children:
00439             for block in delta.children:
00440                 for hunk in block.children:                
00441                     self.validate_hunk(hunk) 

def DybPython::dbsvn::DBIValidate::validate_hunk (   self,
  hunk 
)
Check the Vld table diff validity entries have valid times and conform 
to overlay versioning compliance.

Turns out not to be possible to check for overlay versioning compliance from a delta 
as in the case of updates with changed timestart the offset from the first timestart gets 
used, see #868

NB this has to run on SVN server without NuWa, and potentially with 
an ancient python, so hardcoded constants and conservative style are necessary

Definition at line 442 of file dbsvn.py.

00443                                    :
00444         """
00445         Check the Vld table diff validity entries have valid times and conform 
00446         to overlay versioning compliance.
00447 
00448         Turns out not to be possible to check for overlay versioning compliance from a delta 
00449         as in the case of updates with changed timestart the offset from the first timestart gets 
00450         used, see #868
00451 
00452         NB this has to run on SVN server without NuWa, and potentially with 
00453         an ancient python, so hardcoded constants and conservative style are necessary
00454 
00455         """
00456         name = hunk.parent.parent.name
00457         c = hunk.meta.get('c',None)  
00458         tbot_data, tbot_mc = datetime(2009,1,1,0,0,0), datetime(1970,1,1,0,0,0)
00459         teot = datetime(2038,1,19,3,14,7)
00460         if name.endswith('Vld') and c == "+":
00461             for vld in hunk:
00462                 vs = ValidityString(vld[1:])
00463                 ismc = vs['SIMMASK'].isbitset(1)  # 0-based
00464                 if ismc:
00465                     tbot = tbot_mc
00466                 else:
00467                     tbot = tbot_data
00468                 for dt in map( lambda _:vs[_].datetime, vs.dates):
00469                     assert tbot <= dt <= teot, ("time %s is out of range, ismc %s SIMMASK %s " % (dt, ismc, vs['SIMMASK'] ), )
00470                 #vc = VChk(vs)() 
00471                 #assert len(vc) == 0, vc
00472                 #print vc 
00473 

def DybPython::dbsvn::DBIValidate::dump_diff (   self)
Traverse the parsed diff hierarchy  diff/delta/block/hunk to extract the validity diffs such as::

    +30,"2010-09-22 12:26:59","2038-01-19 03:14:07",127,3,0,1,-1,"2010-09-22 12:26:59","2011-05-05 05:24:00"

deltas should have a single block for a valid update

Definition at line 474 of file dbsvn.py.

00475                        :
00476         """
00477         Traverse the parsed diff hierarchy  diff/delta/block/hunk to extract the validity diffs such as::
00478         
00479             +30,"2010-09-22 12:26:59","2038-01-19 03:14:07",127,3,0,1,-1,"2010-09-22 12:26:59","2011-05-05 05:24:00"
00480         
00481         deltas should have a single block for a valid update
00482         """
00483         for delta in self.diff.children:
00484             print "\n" + "d" * 15 + " %r [%s]" % ( delta, delta.name) + "d" * 15
00485             #print delta
00486             for block in delta.children:
00487                 print "\n" + "b" * 15 + " %r [%s] " % (block, block.parent.name) + "b" * 15
00488                 #print block
00489                 for hunk in block.children:                
00490                     print "\n" + "h" * 15 + " %r [%s] [%s] " % ( hunk, hunk.parent.parent.name, hunk.meta['c'] ) + "h" * 15
00491                     print hunk
00492 

def DybPython::dbsvn::DBIValidate::__call__ (   self)

Definition at line 493 of file dbsvn.py.

00494                       :
00495         self.validate_msg()
00496         self.validate_update()
00497         self.validate_validity()
00498         #self.dump_diff()
00499 
00500 


Member Data Documentation

Definition at line 383 of file dbsvn.py.

Definition at line 383 of file dbsvn.py.

Definition at line 383 of file dbsvn.py.

Definition at line 383 of file dbsvn.py.

Definition at line 383 of file dbsvn.py.

Definition at line 401 of file dbsvn.py.


Property Documentation

DybPython::dbsvn::DBIValidate::tables = property(lambda self:[c.name for c in self.diff.children]) [static]

Definition at line 393 of file dbsvn.py.

DybPython::dbsvn::DBIValidate::exts = property(lambda self:[c.ext for c in self.diff.children]) [static]

Definition at line 394 of file dbsvn.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:41 for DybPython by doxygen 1.7.4