|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.deas.hyperenc.HyperStorage
edu.harvard.deas.hyperenc.BasicHyperStorage
public class BasicHyperStorage
Stores unreconciled pages and corresponding hash values, reconciled pages, system blocks, and encryption blocks for a single contact.
Thread safety: This implementation is unconditionally thread-safe.
Constructor Summary | |
---|---|
BasicHyperStorage(Contact contact,
Direction direction,
RandomSource rs,
MessageDigest md,
PageShuffler ps)
Constructor. |
Method Summary | |
---|---|
int |
addEncBlock(byte[] block)
Adds an encryption block. |
void |
addRPage(byte[] page)
Store a page that has been reconciled. |
int |
addSysBlock(byte[][] blocks)
Adds a system block. |
void |
addUPage(int id,
byte[] page,
byte[] hash)
Adds a page of randomness that has yet to be reconciled, along with its hash. |
Contact |
getContact()
Get the communication partner for this HyperStorage |
MessageDigest |
getDigest()
Gets the stored MessageDigest object for this HyperStorage. |
Direction |
getDirection()
The direction of communication for this HyperStorage. |
byte[] |
getEncBlock(int id)
Retrieve the encryption block with the given ID. |
List<Integer> |
getEncBlockList()
Gets a List of IDs of available encryption blocks. |
PageShuffler |
getShuffler()
|
RandomSource |
getSource()
Gets the stored RandomSource object for this HyperStorage. |
byte[][] |
getSysBlock(int id)
Retrieve the system block with the given ID. |
List<Integer> |
getSysBlockList()
Gets a List of IDs of available system blocks. |
byte[] |
getUHash(int id)
Retrieve hash of the unreconciled page with the given ID. |
byte[] |
getUPage(int id)
Retrieve the unreconciled page with the given ID. |
List<Integer> |
getUPageList()
Gets a List of IDs of available unreconciled pages. |
int |
numEncBlocks()
|
int |
numRPages()
|
int |
numSysBlocks()
|
int |
numUPages()
|
byte[] |
remEncBlock(int id)
Removes and returns encryption block with the given ID. |
List<byte[]> |
remEncBlockList(List<Integer> idlist)
Removes and returns all the encryption blocks with the given IDs. |
byte[] |
remRPage()
Removes and returns the first reconciled page from the FIFO queue. |
byte[][] |
remSysBlock(int id)
Removes and returns system block with the given ID. |
byte[] |
remUPage(int id)
Removes and returns unreconciled page with the given ID, and remove the corresponding hash. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicHyperStorage(Contact contact, Direction direction, RandomSource rs, MessageDigest md, PageShuffler ps)
contact
- The partner for whom this storage stores thingsdirection
- Indicates if this storage is the master of the communication pathrs
- The random source used to create pages for this path of
communicationMethod Detail |
---|
public int addSysBlock(byte[][] blocks)
HyperStorage
HyperCollector.NUM_SYSBLOCKS
subblocks.
addSysBlock
in class HyperStorage
blocks
- Data for block.
public int addEncBlock(byte[] block)
HyperStorage
addEncBlock
in class HyperStorage
block
- Data for block.
public void addUPage(int id, byte[] page, byte[] hash)
HyperStorage
addUPage
in class HyperStorage
id
- ID number for the Page. This is the same as the ID for the block
from which it was generated.page
- The unreconciled page.hash
- The hash of page
.public void addRPage(byte[] page)
HyperStorage
addRPage
in class HyperStorage
page
- The reconciled page.public List<Integer> getSysBlockList()
HyperStorage
getSysBlockList
in class HyperStorage
public List<Integer> getEncBlockList()
HyperStorage
getEncBlockList
in class HyperStorage
public List<Integer> getUPageList()
HyperStorage
getUPageList
in class HyperStorage
public byte[][] getSysBlock(int id)
HyperStorage
getSysBlock
in class HyperStorage
id
- ID number of desired system block.
public byte[] getEncBlock(int id)
HyperStorage
getEncBlock
in class HyperStorage
id
- ID number of desired encryption block.
public byte[] getUPage(int id)
HyperStorage
getUPage
in class HyperStorage
id
- ID of desired page.
public byte[] getUHash(int id)
HyperStorage
getUHash
in class HyperStorage
id
- ID of desired page.
public byte[][] remSysBlock(int id)
HyperStorage
remSysBlock
in class HyperStorage
id
- ID of block.
public byte[] remEncBlock(int id)
HyperStorage
remEncBlock
in class HyperStorage
id
- ID of block.
public List<byte[]> remEncBlockList(List<Integer> idlist) throws BlockMissingException
HyperStorage
remEncBlockList
in class HyperStorage
idlist
- a list of integer encryption block IDs
BlockMissingException
- if any of the specified IDs are missing. The IDs of the missing
blocks can be accessed from the getMissingIDList
method of BlockMissingException.public byte[] remUPage(int id)
HyperStorage
remUPage
in class HyperStorage
id
- ID of page.
public byte[] remRPage()
HyperStorage
remRPage
in class HyperStorage
null
if there are none)public int numSysBlocks()
numSysBlocks
in class HyperStorage
public int numEncBlocks()
numEncBlocks
in class HyperStorage
public int numUPages()
numUPages
in class HyperStorage
public int numRPages()
numRPages
in class HyperStorage
public Contact getContact()
HyperStorage
getContact
in class HyperStorage
public RandomSource getSource()
HyperStorage
getSource
in class HyperStorage
public MessageDigest getDigest()
HyperStorage
getDigest
in class HyperStorage
public PageShuffler getShuffler()
getShuffler
in class HyperStorage
public Direction getDirection()
HyperStorage
getContact()
). If SLAVE,
this storage is used for incoming communication: receiving messages from
the partner.
getDirection
in class HyperStorage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |