#
# 6: implement other sorts of IStorageClient classes: S3, etc
-try:
- from hashlib import sha1
-except ImportError:
- # hashlib was added in Python 2.5
- import sha
- def sha1(x):
- return sha.new(x)
import time
from zope.interface import implements, Interface
from allmydata.util import idlib, log
from allmydata.util.assertutil import _assert, precondition
from allmydata.util.rrefutil import add_version_to_remote_reference
+from allmydata.util.hashutil import sha1
# who is responsible for de-duplication?
# both?
# or the control.furl .
import os.path
-import sha
from zope.interface import implements
from twisted.application import service
from twisted.internet import reactor
from allmydata.client import Client
from allmydata.storage.server import StorageServer, storage_index_to_dir
from allmydata.util import fileutil, idlib, hashutil
+from allmydata.util.hashutil import sha1
from allmydata.test.common_web import HTTPClientGETFactory
from allmydata.interfaces import IStorageBroker
implements(IStorageBroker)
def get_servers_for_index(self, key):
return sorted(self.client._servers,
- key=lambda x: sha.new(key+x[0]).digest())
+ key=lambda x: sha1(key+x[0]).digest())
def get_all_servers(self):
return frozenset(self.client._servers)
def get_nickname_for_serverid(self, serverid):
import os
from allmydata.util.netstring import netstring
+try:
+ import hashlib
+ sha1 = hashlib.sha1
+except ImportError:
+ # hashlib was added in Python 2.5
+ import sha
+ sha1 = sha.new
+
# Be very very cautious when modifying this file. Almost any change will
# cause a compatibility break, invalidating all outstanding URIs and making
# any previously uploaded files become inaccessible. BE CONSERVATIVE AND TEST