[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/lava/gzz/storm/util DiffingStormFiler.java
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz/lava/gzz/storm/util DiffingStormFiler.java |
Date: |
Tue, 14 Jan 2003 12:21:51 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 03/01/14 12:21:51
Modified files:
lava/gzz/storm/util: DiffingStormFiler.java
Log message:
...and scrap them, because this approach is too tangled
and just yields new untrackable errors.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/util/DiffingStormFiler.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/lava/gzz/storm/util/DiffingStormFiler.java
diff -u gzz/lava/gzz/storm/util/DiffingStormFiler.java:1.2
gzz/lava/gzz/storm/util/DiffingStormFiler.java:1.3
--- gzz/lava/gzz/storm/util/DiffingStormFiler.java:1.2 Tue Jan 14 12:20:48 2003
+++ gzz/lava/gzz/storm/util/DiffingStormFiler.java Tue Jan 14 12:21:51 2003
@@ -7,8 +7,7 @@
import java.util.*;
/** A Storm filer that stores diffs between versions if possible.
- * XXX Does not test for spoofing yet! Doesn't handle faulty
- * diffing gracefully either.
+ * XXX Doesn't work yet
*/
public class DiffingStormFiler extends SimpleStormFiler {
@@ -20,87 +19,8 @@
index = (DiffIndexType.Index)pool.getIndex(DiffIndexType.indexTypeURI);
}
- /**
- public Version load(BlockId id) throws IOException {
- return load(id, new Header822[2]);
- }
-
- public Version load(BlockId id, Header822 hdr[]) throws IOException {
- try {
- return super.load(id);
- } catch(FileNotFoundException _) {
- Set diffs = index.getDiffsTo(id);
- if(diffs.isEmpty())
- throw new FileNotFoundException("No diff path to: "+id);
-
- BlockId diffId = (BlockId)diffs.iterator().next();
- Block diffBlock = pool.get(diffId);
- InputStream is = diffBlock.getInputStream();
- Header822 fromHeader = Headers822.readHeader(is);
- Header822 toHeader = Headers822.readHeader(is);
- Version.Diff diff = format.readDiff(is);
- is.close();
-
- BlockId fromId;
- try {
- String hex = diffBlock.getHeader().get("X-Gzz-Diff-From");
- fromId = BlockId.getMediaserverId(hex);
- } catch(NoSuchElementException __) {
- fromId = null;
- }
-
- Version from;
- if(fromId != null)
- from = load(fromId);
- else
- from = emptyVersion;
-
- hdr[0] = fromHeader;
- hdr[1] = toHeader;
- return diff.applyTo(from);
- }
- }
-
- public void save(Version v) throws IOException {
- Version old;
- BlockId oldId = null;
- Header822 oldHeader = null;
- if(current != null) {
- Header822[] old_hdrs = new Header822[2];
- old = load(current.getTarget(), old_hdrs);
- oldId = current.getTarget();
- oldHeader = old_hdrs[1];
- } else {
- old = emptyVersion;
- oldHeader = new VerbatimHeader822(); // empty header
- }
-
- if(old.equals(v)) return;
-
- Block newBlock = saveVersion(v);
-
- BlockId newId = newBlock.getId();
- Header822 newHeader = newBlock.getHeader();
-
- Version.Diff diff = v.getDiffFrom(old);
-
- Header822 hdr = new SortedHeader822();
- hdr.add("Content-Type", diffContentType);
- hdr.add("Content-Transfer-Encoding", "binary");
- if(oldId != null)
- hdr.add("X-Gzz-Diff-From", oldId.getHex());
- hdr.add("X-Gzz-Diff-To", newId.getHex());
-
- BlockOutputStream bos = pool.getBlockOutputStream(hdr);
- oldHeader.writeTo(bos);
- newHeader.writeTo(bos);
- format.writeDiff(bos, diff);
- bos.close();
-
- //pool.delete(newBlock);
- }
- */
+ // XXX
// should be simply named .Group
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/lava/gzz/storm/util DiffingStormFiler.java,
Benja Fallenstein <=