# # Copyright (c) 2002, Benja Fallenstein # # You may use and distribute under the terms of either the GNU Lesser # General Public License, either version 2 of the license or, # at your choice, any later version. Alternatively, you may use and # distribute under the terms of the XPL. # # See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of # the licenses. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README # file for more details. # # "How to load and save a space" # (consisting mainly of how to set up the stage in order # to perform those tasks-- then, they're one-liners) # First, create the space we'll be using, and the enfilade maker. import gzz from test.tools import tools space = gzz.impl.ModularSpace(*tools.spaceArgList()) enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker() # Next, the mediaserver we'll save to. ms = gzz.mediaserver.SimpleMediaserver( gzz.mediaserver.storage.TransientStorer()) # We'll use a fake mediaserver pointer pointer_id = "FOO" # We need to get a "filer" for storing versions of our space. # Accept this part as 'magic' for now... filers = gzz.mediaserver.MediaserverFiler.Group( gzz.slices.SliceVersion.EMPTY_VERSION, ms, gzz.slices.YAMLVersionFormatter.YAMLVersionFormat(ms, enfMaker)) filer = filers.getFiler("FOO") # Now, saving the space is a one-liner: filers.saveAll(space.getSlicer().exportAll()) # So is loading: space = gzz.impl.ModularSpace(filer.load(), *tools.spaceArgList())