Exemple #1
0
    #
    # Arrange to see what JVM invocations are issued.
    #
    #celestefs.verbose = True

    #
    # Ensure that the credential corresponding to myId and myPassword exists.
    #
    if not celestefs.credentialExists(myId):
        celestefs.mkid()

    #
    # Now do the same thing for the file system in which the directory and its
    # entries are to live.
    #
    if not celestefs.fileSystemExists(fileSystemName):
        fsAttrs = {
            "MaintainSerialNumbers" : "false"
        }
        celestefs.mkfs(fileSystemName, fileSystemPassword, attrs=fsAttrs)

    nameGen = FileNameGenerator(20)

    #
    # XXX:  The code below assumes that name collisions won't happen.
    #       Assuming that self.rv is freshly seeded each time (as advertised
    #       in the documentation for the random module), a violation of this
    #       assumption should be negligibly improbable.
    #

    #
Exemple #2
0
#

from celestefs import Celestefs
from sys import exit, stderr

if __name__ == "__main__":

    name = "offsetTest"

    c = Celestefs(name, name)
    c.verbose = True

    if not c.credentialExists(name):
        c.mkid()

    if not c.fileSystemExists(name):
        if not c.mkfs(name, name):
            print "mkfs(%s, %s) failed" % (name, name)
            exit(1)

    filename = "/" + name + "/" + "file"

    #
    # Create or truncate the test file, as approriate.
    #
    if not c.fileExists(filename):
        createAttrs = {
            # "BlockSize" : "3"
            # "BlockSize" : "16"
        }
        c.create(filename, contentType="text/plain", attrs=createAttrs)