gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gzz mediaserver/MediaserverFiler.java util/...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/gzz mediaserver/MediaserverFiler.java util/...
Date: Sat, 16 Nov 2002 09:07:34 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/11/16 09:07:33

Modified files:
        gzz/mediaserver: MediaserverFiler.java 
        gzz/util       : Filer.java 

Log message:
        Javadoc, small refactoring

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/mediaserver/MediaserverFiler.java.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/Filer.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/gzz/mediaserver/MediaserverFiler.java
diff -u gzz/gzz/mediaserver/MediaserverFiler.java:1.13 
gzz/gzz/mediaserver/MediaserverFiler.java:1.14
--- gzz/gzz/mediaserver/MediaserverFiler.java:1.13      Thu Oct  3 15:48:29 2002
+++ gzz/gzz/mediaserver/MediaserverFiler.java   Sat Nov 16 09:07:33 2002
@@ -42,11 +42,12 @@
 
     public static class Group extends Filer.AbstractGroup {
         public Mediaserver ms;
+       Version emptyVersion;
        VersionFormat fmt;
 
        public Group(Version emptyVersion, Mediaserver ms, VersionFormat fmt) {
-           super(emptyVersion);
            this.ms = ms;
+           this.emptyVersion = emptyVersion;
            this.fmt = fmt;
        }
        protected Filer createFiler(String id) throws IOException {
Index: gzz/gzz/util/Filer.java
diff -u gzz/gzz/util/Filer.java:1.3 gzz/gzz/util/Filer.java:1.4
--- gzz/gzz/util/Filer.java:1.3 Mon Sep 16 07:24:23 2002
+++ gzz/gzz/util/Filer.java     Sat Nov 16 09:07:33 2002
@@ -24,13 +24,59 @@
 import java.io.IOException;
 import java.util.*;
 
+/** A "place" a <code>Version</code> can be loaded from and saved to.
+ *  The current implementation of this interface represents 
+ *  a Storm pointer: Loading gets the latest version this pointer
+ *  points to, and saving puts the new version into the Storm pool,
+ *  setting the pointer to it. (The additional complexity of choosing
+ *  between current versions has to be handled by the <code>Filer</code>.)
+ *  <p>
+ *  The intent is that this interface could as well be used to
+ *  save a version to a file; in that case, loading simply gets
+ *  the current version and saving writes a new one to the file,
+ *  overwriting the old one. This way, you could write an application
+ *  that is capable of storing data both in a file and in Storm.
+ */
 public interface Filer {
+    /** A mapping from ids (opaque URIs) to <code>Filer</code>s.
+     *  This is the interface the Gzz client uses to communicate
+     *  with its backend; each slice is stored in a separate
+     *  <code>Filer</code> identified by the slice's id.
+     *  <p>
+     *  In a Storm implementation, this object represents a Storm pool;
+     *  pointer ids are mapped to <code>Filer</code>s for those
+     *  pointers.
+     *  <p>
+     *  In a file-based implementation, this would be something
+     *  like a directory, mapping file names to <code>Filer</code>s
+     *  for the respective files. <strong>However</strong>,
+     *  the abstraction currently breaks there: The opaque URIs
+     *  (e.g., <code>urn:urn-5:</code>s) are not usable as file names
+     *  (without breaking people's assumptions how files work,
+     *  and the point here is to provide an interface that can be
+     *  implemented in a way matching peoples' expectations).
+     *  This needs more thinking: how can this interface be made
+     *  so that it works with files <em>and</em> Storm as expected?
+     */
     interface Group {
+       /** Get the <code>Filer</code> for the given id (opaque URI).
+        */
        Filer getFiler(String id) throws IOException;
+
+       /** Take a <code>Map</code> from <code>Filer</code> ids
+        *  (<code>String</code>s representing opaque URIs)
+        *  to <code>Version</code>; for each entry
+        *  in the <code>Map</code>, get the appropriate
+        *  <code>Filer</code> and save the <code>Version</code>
+        *  to it.
+        */
        void saveAll(Map versions) throws IOException;
     }
 
+    /** Load the current version stored in this filer. */
     Version load() throws IOException;
+
+    /** Save a version into this filer. */
     void save(Version v) throws IOException;
 
 
@@ -38,11 +84,7 @@
        abstract protected Filer createFiler(String id) throws IOException;
 
        protected Map filers = new HashMap();
-       protected Version emptyVersion;
 
-       public AbstractGroup(Version emptyVersion) {
-           this.emptyVersion = emptyVersion;
-       }
         public Filer getFiler(String id) throws IOException {
            Filer f = (Filer)filers.get(id);
            if(f == null) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]