From 7394607141e78127e895243fd90430f249679e87 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 16 Jul 2008 13:14:39 -0700
Subject: [PATCH] move encode/upload/download/checker.py into a new immutable/
 directory. No behavior changes expected.

---
 src/allmydata/client.py                   | 6 +++---
 src/allmydata/control.py                  | 2 +-
 src/allmydata/immutable/__init__.py       | 0
 src/allmydata/{ => immutable}/checker.py  | 3 ++-
 src/allmydata/{ => immutable}/download.py | 2 +-
 src/allmydata/{ => immutable}/encode.py   | 0
 src/allmydata/{ => immutable}/filenode.py | 4 ++--
 src/allmydata/{ => immutable}/upload.py   | 6 +++++-
 src/allmydata/mutable/node.py             | 2 +-
 src/allmydata/mutable/retrieve.py         | 2 +-
 src/allmydata/offloaded.py                | 3 ++-
 src/allmydata/test/check_memory.py        | 3 ++-
 src/allmydata/test/common.py              | 5 +++--
 src/allmydata/test/test_dirnode.py        | 3 ++-
 src/allmydata/test/test_encode.py         | 3 ++-
 src/allmydata/test/test_filenode.py       | 3 ++-
 src/allmydata/test/test_helper.py         | 3 ++-
 src/allmydata/test/test_mutable.py        | 5 +++--
 src/allmydata/test/test_system.py         | 4 ++--
 src/allmydata/test/test_upload.py         | 3 ++-
 src/allmydata/test/test_web.py            | 3 ++-
 src/allmydata/web/filenode.py             | 2 +-
 src/allmydata/web/unlinked.py             | 2 +-
 23 files changed, 42 insertions(+), 27 deletions(-)
 create mode 100644 src/allmydata/immutable/__init__.py
 rename src/allmydata/{ => immutable}/checker.py (99%)
 rename src/allmydata/{ => immutable}/download.py (99%)
 rename src/allmydata/{ => immutable}/encode.py (100%)
 rename src/allmydata/{ => immutable}/filenode.py (96%)
 rename src/allmydata/{ => immutable}/upload.py (99%)

diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index 4e1121a5..47f4fd20 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -12,13 +12,13 @@ from pycryptopp.publickey import rsa
 
 import allmydata
 from allmydata.storage import StorageServer
-from allmydata.upload import Uploader
-from allmydata.download import Downloader
+from allmydata.immutable.upload import Uploader
+from allmydata.immutable.download import Downloader
+from allmydata.immutable.filenode import FileNode, LiteralFileNode
 from allmydata.offloaded import Helper
 from allmydata.control import ControlServer
 from allmydata.introducer.client import IntroducerClient
 from allmydata.util import hashutil, base32, testutil
-from allmydata.filenode import FileNode, LiteralFileNode
 from allmydata.uri import LiteralFileURI
 from allmydata.dirnode import NewDirectoryNode
 from allmydata.mutable.node import MutableFileNode, MutableWatcher
diff --git a/src/allmydata/control.py b/src/allmydata/control.py
index 99a3139b..ce8590c9 100644
--- a/src/allmydata/control.py
+++ b/src/allmydata/control.py
@@ -6,7 +6,7 @@ from twisted.internet import defer
 from foolscap import Referenceable
 from allmydata.interfaces import RIControlClient
 from allmydata.util import testutil, fileutil, mathutil
-from allmydata import upload, download
+from allmydata.immutable import upload, download
 from twisted.python import log
 
 def get_memory_usage():
diff --git a/src/allmydata/immutable/__init__.py b/src/allmydata/immutable/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/src/allmydata/checker.py b/src/allmydata/immutable/checker.py
similarity index 99%
rename from src/allmydata/checker.py
rename to src/allmydata/immutable/checker.py
index 8e559c48..c49aeb28 100644
--- a/src/allmydata/checker.py
+++ b/src/allmydata/immutable/checker.py
@@ -9,8 +9,9 @@ have the share, we believe them.
 from zope.interface import implements
 from twisted.internet import defer
 from twisted.python import log
+from allmydata import storage
 from allmydata.interfaces import IVerifierURI, ICheckerResults
-from allmydata import download, storage
+from allmydata.immutable import download
 from allmydata.util import hashutil, base32
 
 class Results:
diff --git a/src/allmydata/download.py b/src/allmydata/immutable/download.py
similarity index 99%
rename from src/allmydata/download.py
rename to src/allmydata/immutable/download.py
index a0bf0e19..983575ed 100644
--- a/src/allmydata/download.py
+++ b/src/allmydata/immutable/download.py
@@ -11,7 +11,7 @@ from allmydata.util.assertutil import _assert
 from allmydata import codec, hashtree, storage, uri
 from allmydata.interfaces import IDownloadTarget, IDownloader, IFileURI, \
      IDownloadStatus, IDownloadResults
-from allmydata.encode import NotEnoughSharesError
+from allmydata.immutable.encode import NotEnoughSharesError
 from pycryptopp.cipher.aes import AES
 
 class HaveAllPeersError(Exception):
diff --git a/src/allmydata/encode.py b/src/allmydata/immutable/encode.py
similarity index 100%
rename from src/allmydata/encode.py
rename to src/allmydata/immutable/encode.py
diff --git a/src/allmydata/filenode.py b/src/allmydata/immutable/filenode.py
similarity index 96%
rename from src/allmydata/filenode.py
rename to src/allmydata/immutable/filenode.py
index 2d0f2a36..c3caae73 100644
--- a/src/allmydata/filenode.py
+++ b/src/allmydata/immutable/filenode.py
@@ -3,8 +3,8 @@ from zope.interface import implements
 from twisted.internet import defer
 from allmydata.interfaces import IFileNode, IFileURI, IURI, ICheckable
 from allmydata import uri
-from allmydata.checker import SimpleCHKFileChecker, SimpleCHKFileVerifier, \
-     Results
+from allmydata.immutable.checker import Results, \
+     SimpleCHKFileChecker, SimpleCHKFileVerifier
 
 class FileNode:
     implements(IFileNode, ICheckable)
diff --git a/src/allmydata/upload.py b/src/allmydata/immutable/upload.py
similarity index 99%
rename from src/allmydata/upload.py
rename to src/allmydata/immutable/upload.py
index 714e7a53..2f641922 100644
--- a/src/allmydata/upload.py
+++ b/src/allmydata/immutable/upload.py
@@ -12,7 +12,8 @@ from allmydata.util.hashutil import file_renewal_secret_hash, \
      file_cancel_secret_hash, bucket_renewal_secret_hash, \
      bucket_cancel_secret_hash, plaintext_hasher, \
      storage_index_hash, plaintext_segment_hasher, convergence_hasher
-from allmydata import encode, storage, hashtree, uri
+from allmydata import storage, hashtree, uri
+from allmydata.immutable import encode
 from allmydata.util import base32, idlib, mathutil
 from allmydata.util.assertutil import precondition
 from allmydata.interfaces import IUploadable, IUploader, IUploadResults, \
@@ -38,6 +39,9 @@ class TooFullError(Exception):
 
 class UploadResults(Copyable, RemoteCopy):
     implements(IUploadResults)
+    # note: don't change this string, it needs to match the value used on the
+    # helper, and it does *not* need to match the fully-qualified
+    # package/module/class name
     typeToCopy = "allmydata.upload.UploadResults.tahoe.allmydata.com"
     copytype = typeToCopy
 
diff --git a/src/allmydata/mutable/node.py b/src/allmydata/mutable/node.py
index 368b9962..cd9f9763 100644
--- a/src/allmydata/mutable/node.py
+++ b/src/allmydata/mutable/node.py
@@ -10,7 +10,7 @@ from allmydata.interfaces import IMutableFileNode, IMutableFileURI, ICheckable
 from allmydata.util import hashutil
 from allmydata.util.assertutil import precondition
 from allmydata.uri import WriteableSSKFileURI
-from allmydata.encode import NotEnoughSharesError
+from allmydata.immutable.encode import NotEnoughSharesError
 from pycryptopp.publickey import rsa
 from pycryptopp.cipher.aes import AES
 
diff --git a/src/allmydata/mutable/retrieve.py b/src/allmydata/mutable/retrieve.py
index 66a049a4..b844bcf0 100644
--- a/src/allmydata/mutable/retrieve.py
+++ b/src/allmydata/mutable/retrieve.py
@@ -8,7 +8,7 @@ from foolscap.eventual import eventually, fireEventually
 from allmydata.interfaces import IRetrieveStatus
 from allmydata.util import hashutil, idlib, log
 from allmydata import hashtree, codec, storage
-from allmydata.encode import NotEnoughSharesError
+from allmydata.immutable.encode import NotEnoughSharesError
 from pycryptopp.cipher.aes import AES
 
 from common import DictOfSets, CorruptShareError, UncoordinatedWriteError
diff --git a/src/allmydata/offloaded.py b/src/allmydata/offloaded.py
index d4c94a1a..06a5345b 100644
--- a/src/allmydata/offloaded.py
+++ b/src/allmydata/offloaded.py
@@ -5,7 +5,8 @@ from twisted.application import service
 from twisted.internet import defer
 from foolscap import Referenceable
 from foolscap.eventual import eventually
-from allmydata import upload, interfaces, storage, uri
+from allmydata import interfaces, storage, uri
+from allmydata.immutable import upload
 from allmydata.util import idlib, log, observer, fileutil, hashutil
 
 
diff --git a/src/allmydata/test/check_memory.py b/src/allmydata/test/check_memory.py
index 908e21ec..ddfa4337 100644
--- a/src/allmydata/test/check_memory.py
+++ b/src/allmydata/test/check_memory.py
@@ -5,7 +5,8 @@ from cStringIO import StringIO
 from twisted.internet import defer, reactor, protocol, error
 from twisted.application import service, internet
 from twisted.web import client as tw_client
-from allmydata import client, introducer, upload
+from allmydata import client, introducer
+from allmydata.immutable import upload
 from allmydata.scripts import create_node
 from allmydata.util import testutil, fileutil
 import foolscap
diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py
index ce4569a3..09698883 100644
--- a/src/allmydata/test/common.py
+++ b/src/allmydata/test/common.py
@@ -4,10 +4,11 @@ from zope.interface import implements
 from twisted.internet import defer
 from twisted.python import failure
 from twisted.application import service
-from allmydata import uri, dirnode, checker
+from allmydata import uri, dirnode
 from allmydata.interfaces import IURI, IMutableFileNode, IFileNode, \
      FileTooLargeError
-from allmydata.encode import NotEnoughSharesError
+from allmydata.immutable import checker
+from allmydata.immutable.encode import NotEnoughSharesError
 from allmydata.util import log
 
 class FakeCHKFileNode:
diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py
index 9ef0af5a..4aba00c4 100644
--- a/src/allmydata/test/test_dirnode.py
+++ b/src/allmydata/test/test_dirnode.py
@@ -2,7 +2,8 @@
 import time
 from zope.interface import implements
 from twisted.trial import unittest
-from allmydata import uri, dirnode, upload
+from allmydata import uri, dirnode
+from allmydata.immutable import upload
 from allmydata.interfaces import IURI, IClient, IMutableFileNode, \
      INewDirectoryURI, IReadonlyNewDirectoryURI, IFileNode, ExistingChildError
 from allmydata.util import hashutil, testutil
diff --git a/src/allmydata/test/test_encode.py b/src/allmydata/test/test_encode.py
index 6ba0e6db..bb9ba969 100644
--- a/src/allmydata/test/test_encode.py
+++ b/src/allmydata/test/test_encode.py
@@ -5,7 +5,8 @@ from twisted.internet import defer, reactor
 from twisted.internet.interfaces import IConsumer
 from twisted.python.failure import Failure
 from foolscap import eventual
-from allmydata import encode, upload, download, hashtree, uri
+from allmydata import hashtree, uri
+from allmydata.immutable import encode, upload, download
 from allmydata.util import hashutil, testutil
 from allmydata.util.assertutil import _assert
 from allmydata.interfaces import IStorageBucketWriter, IStorageBucketReader
diff --git a/src/allmydata/test/test_filenode.py b/src/allmydata/test/test_filenode.py
index 39f7abb5..a08e97bf 100644
--- a/src/allmydata/test/test_filenode.py
+++ b/src/allmydata/test/test_filenode.py
@@ -1,6 +1,7 @@
 
 from twisted.trial import unittest
-from allmydata import filenode, uri, download
+from allmydata import uri
+from allmydata.immutable import filenode, download
 from allmydata.mutable.node import MutableFileNode
 from allmydata.util import hashutil
 
diff --git a/src/allmydata/test/test_helper.py b/src/allmydata/test/test_helper.py
index d72b9514..2f61eab2 100644
--- a/src/allmydata/test/test_helper.py
+++ b/src/allmydata/test/test_helper.py
@@ -6,7 +6,8 @@ from twisted.application import service
 from foolscap import Tub, eventual
 from foolscap.logging import log
 
-from allmydata import offloaded, storage, upload
+from allmydata import offloaded, storage
+from allmydata.immutable import upload
 from allmydata.util import hashutil, fileutil, mathutil
 from pycryptopp.cipher.aes import AES
 
diff --git a/src/allmydata/test/test_mutable.py b/src/allmydata/test/test_mutable.py
index eb80b181..3ce59502 100644
--- a/src/allmydata/test/test_mutable.py
+++ b/src/allmydata/test/test_mutable.py
@@ -4,12 +4,13 @@ from cStringIO import StringIO
 from twisted.trial import unittest
 from twisted.internet import defer, reactor
 from twisted.python import failure
-from allmydata import uri, download, storage
+from allmydata import uri, storage
+from allmydata.immutable import download
+from allmydata.immutable.encode import NotEnoughSharesError
 from allmydata.util import base32, testutil, idlib
 from allmydata.util.idlib import shortnodeid_b2a
 from allmydata.util.hashutil import tagged_hash
 from allmydata.util.fileutil import make_dirs
-from allmydata.encode import NotEnoughSharesError
 from allmydata.interfaces import IURI, IMutableFileURI, IUploadable, \
      FileTooLargeError
 from foolscap.eventual import eventually, fireEventually
diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py
index 2b3e7a1a..237b8920 100644
--- a/src/allmydata/test/test_system.py
+++ b/src/allmydata/test/test_system.py
@@ -8,8 +8,8 @@ from twisted.internet import threads # CLI tests use deferToThread
 from twisted.internet.error import ConnectionDone, ConnectionLost
 from twisted.application import service
 import allmydata
-from allmydata import client, uri, download, upload, storage, offloaded, \
-     filenode
+from allmydata import client, uri, storage, offloaded
+from allmydata.immutable import download, upload, filenode
 from allmydata.introducer.server import IntroducerNode
 from allmydata.util import fileutil, idlib, mathutil, testutil
 from allmydata.util import log, base32
diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py
index 7dd7e008..221c985b 100644
--- a/src/allmydata/test/test_upload.py
+++ b/src/allmydata/test/test_upload.py
@@ -6,7 +6,8 @@ from twisted.python import log
 from twisted.internet import defer
 from cStringIO import StringIO
 
-from allmydata import upload, encode, uri
+from allmydata import uri
+from allmydata.immutable import upload, encode
 from allmydata.interfaces import IFileURI, FileTooLargeError
 from allmydata.util.assertutil import precondition
 from allmydata.util.deferredutil import DeferredListShouldSucceed
diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index 326689a3..6ef18678 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -5,7 +5,8 @@ from twisted.trial import unittest
 from twisted.internet import defer, reactor
 from twisted.web import client, error, http
 from twisted.python import failure, log
-from allmydata import interfaces, provisioning, uri, webish, upload, download
+from allmydata import interfaces, provisioning, uri, webish
+from allmydata.immutable import upload, download
 from allmydata.web import status, common
 from allmydata.util import fileutil
 from allmydata.test.common import FakeDirectoryNode, FakeCHKFileNode, \
diff --git a/src/allmydata/web/filenode.py b/src/allmydata/web/filenode.py
index 19b1b47e..9a9a28ef 100644
--- a/src/allmydata/web/filenode.py
+++ b/src/allmydata/web/filenode.py
@@ -8,9 +8,9 @@ from twisted.internet import defer
 from nevow import url, rend
 from nevow.inevow import IRequest
 
-from allmydata.upload import FileHandle
 from allmydata.interfaces import IDownloadTarget, ExistingChildError
 from allmydata.mutable.common import MODE_READ
+from allmydata.immutable.upload import FileHandle
 from allmydata.util import log
 
 from allmydata.web.common import text_plain, WebError, IClient, RenderMixin, \
diff --git a/src/allmydata/web/unlinked.py b/src/allmydata/web/unlinked.py
index 076908e9..3b8d9538 100644
--- a/src/allmydata/web/unlinked.py
+++ b/src/allmydata/web/unlinked.py
@@ -4,7 +4,7 @@ from twisted.web import http
 from twisted.internet import defer
 from nevow import rend, url, tags as T
 from nevow.inevow import IRequest
-from allmydata.upload import FileHandle
+from allmydata.immutable.upload import FileHandle
 from allmydata.web.common import IClient, getxmlfile, get_arg, boolean_of_arg
 from allmydata.web import status
 
-- 
2.45.2