parameters: (path,archiveList,xFilesFactor=0.5)
docstring: create(path,archiveList,xFilesFactor=0.5)
  
  path is a string
  archiveList is a list of archives, each of which is of the form (secondsPerPoint,numberOfPoints)
  xFilesFactor specifies the fraction of data points in a propagation interval that must have known values for a propagation to occur
docstring_summary: create(path,archiveList,xFilesFactor=0.5)
docstring_tokens: create ( path archiveList xFilesFactor = 0 . 5 )
function: def create(path,archiveList,xFilesFactor=0.5):
    """create(path,archiveList,xFilesFactor=0.5)
  
  path is a string
  archiveList is a list of archives, each of which is of the form (secondsPerPoint,numberOfPoints)
  xFilesFactor specifies the fraction of data points in a propagation interval that must have known values for a propagation to occur
  """
    #Validate archive configurations...
    assert archiveList, "You must specify at least one archive configuration!"
    archiveList.sort(key=lambda a: a[0]) #sort by precision (secondsPerPoint)
    for i,archive in enumerate(archiveList):
      if i == len(archiveList) - 1: break
      next = archiveList[i+1]
      assert archive[0] < next[0],\
          "You cannot configure two archives with the same precision %s,%s" % (archive,next)
      assert (next[0] % archive[0]) == 0,\
          "Higher precision archives' precision must evenly divide all lower precision archives' precision %s,%s" % (archive[0],next[0])
      retention = archive[0] * archive[1]
      nextRetention = next[0] * next[1]
      assert nextRetention > retention,\
          "Lower precision archives must cover larger time intervals than higher precision archives %s,%s" % (archive,next)
    #Looks good, now we create the file and write the header
    assert not exists(path), "File %s already exists!" % path
    fh = open(path,'wb')
    if LOCK: fcntl.flock( fh.fileno(), fcntl.LOCK_EX )
    lastUpdate = struct.pack( timestampFormat, int(time.time()) )
    oldest = sorted([secondsPerPoint * points for secondsPerPoint,points in archiveList])[-1]
    maxRetention = struct.pack( longFormat, oldest )
    xFilesFactor = struct.pack( floatFormat, float(xFilesFactor) )
    archiveCount = struct.pack(longFormat, len(archiveList))
    packedMetadata = lastUpdate + maxRetention + xFilesFactor + archiveCount
    fh.write(packedMetadata)
    headerSize = metadataSize + (archiveInfoSize * len(archiveList))
    archiveOffsetPointer = headerSize
    for secondsPerPoint,points in archiveList:
      archiveInfo = struct.pack(archiveInfoFormat, archiveOffsetPointer, secondsPerPoint, points)
      fh.write(archiveInfo)
      archiveOffsetPointer += (points * pointSize)
    zeroes = '\x00' * (archiveOffsetPointer - headerSize)
    fh.write(zeroes)
    fh.close()
function_tokens: def create ( path , archiveList , xFilesFactor = 0.5 ) : #Validate archive configurations... assert archiveList , "You must specify at least one archive configuration!" archiveList . sort ( key = lambda a : a [ 0 ] ) #sort by precision (secondsPerPoint) for i , archive in enumerate ( archiveList ) : if i == len ( archiveList ) - 1 : break next = archiveList [ i + 1 ] assert archive [ 0 ] < next [ 0 ] , "You cannot configure two archives with the same precision %s,%s" % ( archive , next ) assert ( next [ 0 ] % archive [ 0 ] ) == 0 , "Higher precision archives' precision must evenly divide all lower precision archives' precision %s,%s" % ( archive [ 0 ] , next [ 0 ] ) retention = archive [ 0 ] * archive [ 1 ] nextRetention = next [ 0 ] * next [ 1 ] assert nextRetention > retention , "Lower precision archives must cover larger time intervals than higher precision archives %s,%s" % ( archive , next ) #Looks good, now we create the file and write the header assert not exists ( path ) , "File %s already exists!" % path fh = open ( path , 'wb' ) if LOCK : fcntl . flock ( fh . fileno ( ) , fcntl . LOCK_EX ) lastUpdate = struct . pack ( timestampFormat , int ( time . time ( ) ) ) oldest = sorted ( [ secondsPerPoint * points for secondsPerPoint , points in archiveList ] ) [ - 1 ] maxRetention = struct . pack ( longFormat , oldest ) xFilesFactor = struct . pack ( floatFormat , float ( xFilesFactor ) ) archiveCount = struct . pack ( longFormat , len ( archiveList ) ) packedMetadata = lastUpdate + maxRetention + xFilesFactor + archiveCount fh . write ( packedMetadata ) headerSize = metadataSize + ( archiveInfoSize * len ( archiveList ) ) archiveOffsetPointer = headerSize for secondsPerPoint , points in archiveList : archiveInfo = struct . pack ( archiveInfoFormat , archiveOffsetPointer , secondsPerPoint , points ) fh . write ( archiveInfo ) archiveOffsetPointer += ( points * pointSize ) zeroes = '\x00' * ( archiveOffsetPointer - headerSize ) fh . write ( zeroes ) fh . close ( )