Public Types | |
enum | StatsEnum { Puts = ("ContentObjects", "The number of put calls"), Gets = ("ContentObjects", "The number of get calls"), WriteInterest = ("calls", "The number of calls to write(Interest)"), WriteObject = ("calls", "The number of calls to write(ContentObject)"), WriteErrors = ("count", "Error count for writeInner()"), WriteUnderflows = ("count", "The count of times when the bytes written to the channel < buffer size"), ExpressInterest = ("calls", "The number of calls to expressInterest"), CancelInterest = ("calls", "The number of calls to cancelInterest"), DeliverInterest = ("calls", "The number of calls to deliverInterest"), DeliverContent = ("calls", "The number of calls to cancelInterest"), DeliverInterestMatchingFilters = ("calls", "Count of the number of calls to interest handlers"), DeliverContentMatchingInterests = ("calls", "Count of the number of calls to content handlers"), DeliverContentFailed = ("calls", "The number of content deliveries that failed"), DeliverInterestFailed = ("calls", "The number of interest deliveries that failed"), InterestHandlerTime = ("nanos", "The average amount of time spent in interest handlers"), ContentHandlerTime = ("nanos", "The average amount of time spent in content handlers"), ReceiveObject = ("objects", "Receive count of ContentObjects from channel"), ReceiveInterest = ("interests", "Receive count of Interests from channel"), ReceiveUnknown = ("calls", "Receive count of unknown type from channel"), ReceiveErrors = ("errors", "Number of errors from the channel in run() loop"), ContentObjectsIgnored = ("ContentObjects", "The number of ContentObjects that are never handled"), HandleInterest = ("interests", "Number of calls to RepositoryInterestHandler.handleInterest()"), HandleInterestErrors = ("errors", "Errors in handleInterest()"), HandleInterestCommands = ("interests", "Number of command interests to handleInterest()"), HandleInterestStartWriteReceived = ("interests", "Number of start writes to handleInterest()"), HandleInterestStartWriteProcessed = ("interests", "Number of start writes processed by handleInterest()"), HandleInterestStartWriteIgnored = ("interests", "Number of start writes ignored in handleInterest()"), HandleInterestStartWriteErrors = ("errors", "Error count in startWrite()"), HandleInterestNameEnumReceived = ("interests", "Number of name enums to handleInterest()"), HandleInterestNameEnumProcessed = ("interests", "Number of name enums processed in handleInterest()"), HandleInterestNameEnumIgnored = ("interests", "Number of name enums ignored in handleInterest()"), HandleInterestCheckedWriteReceived = ("interests", "Number of checked write to handleInterest()"), HandleInterestCheckedWriteProcessed = ("interests", "Number of checked write processed in handleInterest()"), HandleInterestCheckedWriteIgnored = ("interests", "Number of checked write ignored in handleInterest()"), HandleInterestBulkImportReceived = ("interests", "Number of bulk imports to handleInterest()"), HandleInterestBulkImportProcessed = ("interests", "Number of bulk imports processed in handleInterest()"), HandleInterestBulkImportIgnored = ("interests", "Number of bulk imports ignored in handleInterest()"), HandleInterestUncategorized = ("interests", "Number of uncategorized interests to handleInterest()"), HandleInterestDuplicateRequests = ("interests", "Number of duplicate interests to handleInterest()"), HandleInterestWriteSuspended = ("interests", "Number of write suspended interests to handleInterest()"), HandleInterestStartWritePolicyHandlers = ("responses", "Number of RepositoryPolicyHandler created for StartWrite"), HandleInterestStartWriteExpressInterest = ("responses", "Number of expressInterests created for StartWrite"), HandleInterestNameEnumResponses = ("responses", "Number of responses sent for Name Enums"), HandleContent = ("objects", "Calls to ResponsitoryDataListener.handleContent()"), HandleContentHandleData = ("objects", "Calls to handleData in RepositoryDataListener"), HandleContentExpressInterest = ("interests", "Number of interests expressed in handleContent()"), HandleContentCancelInterest = ("interests", "Number of interests cancelled"), HandleContentExpressInterestErrors = ("errors", "Number of errors expressing interests in handleContent()"), Receive = ("ContentObjects", "The number of objects received in handleContent"), ReceiveVersionNumberError = ("Errors", "Errors parsing VersionNumber from content name"), ReceiveReturnInterest = ("interests", "Number of non-null interests returned from receive()"), ReceiveIgnored = ("count", "Count of objects ignored because version was out-of-bounds"), ReceiveDuplicates = ("count", "Count of duplicate version numbers received"), ReceiveUnique = ("count", "Count of objects with unique version numbers received"), ReceiveNoPendingInterest = ("Errors", "Received object did not match a pending interest in _interestMap"), Rebuild = ("count", "Calls to rebuild()"), RebuileShiftLeft = ("count", "Number of left-shift rebuilds"), RebuildShiftRight = ("count", "Number of right-shift rebuilds"), RebuildCreateLeft = ("count", "Number of create left neighbor rebuilds"), RebuildCreateRight = ("count", "Number of create right neighbor rebuilds"), RebuildInsertLeft = ("count", "Number of inserts to left rebuilds"), RebuildInsertRight = ("count", "Number of inserts to right rebuilds"), RebuildRollLeft = ("count", "Number of roll left rebuilds"), RebuildRollRight = ("count", "Number of roll right rebuilds"), SendInterest = ("count", "Interests sent (not counting ReceiveReturnInterest)"), CancelInterest = ("count", "Interests cancelled"), SendInterestErrors = ("errors", "Errors calling expressInterest()") } |
Public Member Functions | |
RepositoryServer (RepositoryStore repo) throws IOException | |
Constructor. | |
void | start () |
Start serving requests from the network. | |
void | waitForStart () |
void | shutDown () |
Stop serving requests. | |
void | resetNamespaceFromHandler () throws IOException |
In general we need to wait until all sessions are complete before making a namespace change because it involves changing the filter which could cut off current sessions in process. | |
CCNHandle | getHandle () |
RepositoryStore | getRepository () |
Exclude | getExcludes () |
CCNWriter | getWriter () |
ArrayList< RepositoryDataListener > | getDataListeners () |
void | addListener (RepositoryDataListener listener) |
boolean | getPendingNameSpaceState () |
RepositoryDataHandler | getDataHandler () |
int | getWindowSize () |
int | getFreshness () |
ContentName | getResponseName () |
void | sendEnumerationResponse (NameEnumerationResponse ner) |
Method to write out name enumeration responses. | |
ContentName | getKeyTarget (ContentName target) |
Look for unverified keys. | |
ContentName | getKeyTargetFromObject (ContentObject content, ContentName target) throws RepositoryException |
Look for keys we don't have based on content object. | |
ContentName | getLinkedKeyTarget (ContentObject co) throws RepositoryException |
Check whether co is a link and if so find any unsynced link target which is chained to it. | |
void | doSync (Interest interest, Interest readInterest) throws IOException |
Object | getStatus (String type) |
boolean | isDuplicateRequest (Interest interest) |
Check for duplicate request, i.e. | |
boolean | isWriteSuspended (Interest interest) |
Check whether new writes are allowed now Logs the discarded request if it cannot be processed. | |
CCNStats | getStats () |
Static Public Attributes | |
static final int | PERIOD = 2000 |
static final int | THREAD_LIFE = 8 |
static final int | FRESHNESS = 4 |
Protected Attributes | |
Timer | _periodicTimer = null |
RepositoryInterestHandler | _iHandler = null |
boolean | _started = false |
Object | _startedLock = new Object() |
CCNEnumStats< StatsEnum > | _stats = new CCNEnumStats<StatsEnum>(StatsEnum.HandleInterest) |
Classes | |
class | InterestTimer |
The application must supply a RepositoryStore instance to take care of actual storage and retrieval, which might use persistent storage or application data structures.
Some notes: We use a policy file to decide which namespaces to save. The policy file is currently parsed within the lower level.
We can't just express an interest in anything that's within the namespaces that we want to save within, because we will keep getting back the same content over and over again if we do that. Instead the clients trigger a write to the repository by expressing an interest in contentName + "write_marker" (CCNBase.REPO_START_WRITE). When we see this we write back some information then express an interest in the contentName without the "write_marker" to get the initial block, then express interest in blocks after the initial block for this particular write.
org.ccnx.ccn.impl.repo.RepositoryServer.RepositoryServer | ( | RepositoryStore | repo | ) | throws IOException |
Constructor.
Note that merely creating an instance does not begin service of requests from the network. For that you must call start().
repo | the RepositoryStore instance to use for backing storage. The RepositoryServer uses repo.getHandle() to get the handle to use for communication, to make sure that it is sending messages under the identity of the repo. |
IOException |
void org.ccnx.ccn.impl.repo.RepositoryServer.resetNamespaceFromHandler | ( | ) | throws IOException |
In general we need to wait until all sessions are complete before making a namespace change because it involves changing the filter which could cut off current sessions in process.
IOException |
void org.ccnx.ccn.impl.repo.RepositoryServer.sendEnumerationResponse | ( | NameEnumerationResponse | ner | ) |
Method to write out name enumeration responses.
This is called directly to respond to incoming name enumeration interests and can also be called when a content object is saved in the repo and the interest flag is set by a previous name enumeration interest where there was not new information available.
ner | NameEnumerationResponse object to send out |
ContentName org.ccnx.ccn.impl.repo.RepositoryServer.getKeyTarget | ( | ContentName | target | ) |
Look for unverified keys.
Note that we must have already checked to see that the repo has the content for this target before calling this.
target |
ContentName org.ccnx.ccn.impl.repo.RepositoryServer.getKeyTargetFromObject | ( | ContentObject | content, | |
ContentName | target | |||
) | throws RepositoryException |
Look for keys we don't have based on content object.
content | ||
target |
RepositoryException |
ContentName org.ccnx.ccn.impl.repo.RepositoryServer.getLinkedKeyTarget | ( | ContentObject | co | ) | throws RepositoryException |
Check whether co is a link and if so find any unsynced link target which is chained to it.
co | the ContentObject to test |
RepositoryException |
boolean org.ccnx.ccn.impl.repo.RepositoryServer.isDuplicateRequest | ( | Interest | interest | ) |
Check for duplicate request, i.e.
request already in process Logs the request if found to be a duplicate.
interest | the incoming interest containing the request command |
boolean org.ccnx.ccn.impl.repo.RepositoryServer.isWriteSuspended | ( | Interest | interest | ) |
Check whether new writes are allowed now Logs the discarded request if it cannot be processed.
interest | the incoming interest containing the command |