import os
import struct
import logging
from collections import deque
from dropbox import client, rest, session
from StringIO import StringIO
from util import *
import re
from appkeys import *
#use /dev/random if security matters

class WrongDiskSize(Exception):
	def __init__(self,message):
		super(WrongDiskSize, self).__init__()
		self.message=message



#TODO: should inherit after EncryptedBlockDevice
class DiskDriver(object):
	#TODO: use *args and **kwargs
	def __init__(self,size,sector_size):
		logging.basicConfig(filename='blockcrypt.log',level=logging.DEBUG)
		self.size = size
		self.sector_size = sector_size
		self.logger = logging.getLogger("blockcrypt")
		if size % sector_size != 0:
			print "DD init received %d %d" %(size,sector_size)
			raise WrongDiskSize("disk size must the multiple of sector size %d %d" % (size,sector_size))

	def read(self,sector):
		pass
	def write(self,data):
		pass
	def flush(self):
		pass
	@staticmethod
	def create_disk():