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 | |
VersioningInterestManager (CCNHandle handle, ContentName name, Set< VersionNumber > exclusions, VersionNumber startingVersion, CCNContentHandler handler) | |
Create a VersioningInterestManager for a specific content name. | |
synchronized void | start () throws IOException |
Generate interests and return data to the listener. | |
synchronized void | stop () |
cancel all interests and stop operation | |
Interest | handleContent (ContentObject data, Interest interest) |
Callback called when we get new results for our query. | |
String | dumpExcluded () |
This is purely a debugging aid. | |
CCNStats | getStats () |
Static Public Attributes | |
static final int | MIN_FILL = 50 |
static final int | MID_FILL = 125 |
static final int | MAX_FILL = 200 |
Protected Member Functions | |
Interest | receive (ContentObject data, Interest interest) |
Called from handleInterest. | |
void | rebuild (VersionNumber version, InterestData datum) |
We received a new version and tried to add it to the given datum, but that datum is too full. | |
void | sendInterest (InterestData id) |
Send a new interest and manage the _interestMap. | |
Protected Attributes | |
final CCNHandle | _handle |
final Object | _dataLock = new Object() |
final TreeSet6< VersionNumber > | _exclusions = new TreeSet6<VersionNumber>() |
final TreeSet6< InterestData > | _interestData = new TreeSet6<InterestData>(new InterestData.StartTimeComparator()) |
final Map< Interest, InterestMapData > | _interestMap = new HashMap<Interest, InterestMapData>() |
CCNEnumStats< StatsEnum > | _stats = new CCNEnumStats<StatsEnum>(StatsEnum.Receive) |
Classes | |
class | InterestMapData |
This class is used by VersioningInterest, and should not be used stand-alone.
Current interest filling algorithm: Interests are filled to MIN_FULL exclusions initially and allowed to grow to MAX_FULL exclusions. When MAX_FULL exclusions is reached, the starting times are re-arranged.
This operates by maintaining a set of interests from [startingVersion, infinity). Initially, we issue one interest I_0[startingVersion, infinity). When that interest fills, it is split in to two interests, and it is split to the left: I_-1[startingVersion, k], I_0[k+1, infinity), where "k" is picked to keep MIN_FILL in the right member (I_0).
"infinity" is really the maximum version component, so it is well-defined.
At some point, we will have a series of interests: I0[startingVersion, k0], I1[k0+1, k1], I2[k1+1, k2], I3[k2+1, k3], I4[k3+1, infinity)
Algorithm:
Let the current InterestData be M[a, b].
org.ccnx.ccn.profiles.versioning.VersioningInterestManager.VersioningInterestManager | ( | CCNHandle | handle, | |
ContentName | name, | |||
Set< VersionNumber > | exclusions, | |||
VersionNumber | startingVersion, | |||
CCNContentHandler | handler | |||
) |
Create a VersioningInterestManager for a specific content name.
Send results to the listener.
handle | ||
name | ||
exclusions | may be null or empty | |
startingVersion | non-negative, use 0 for all versions | |
listener |
synchronized void org.ccnx.ccn.profiles.versioning.VersioningInterestManager.start | ( | ) | throws IOException |
Generate interests and return data to the listener.
IOException |
Interest org.ccnx.ccn.profiles.versioning.VersioningInterestManager.handleContent | ( | ContentObject | data, | |
Interest | interest | |||
) |
Callback called when we get new results for our query.
data | the ContentObject that matched our Interest | |
interest | Interest that was satisfied |
Implements org.ccnx.ccn.CCNContentHandler.
Interest org.ccnx.ccn.profiles.versioning.VersioningInterestManager.receive | ( | ContentObject | data, | |
Interest | interest | |||
) | [protected] |
Called from handleInterest.
data | ||
interest |
void org.ccnx.ccn.profiles.versioning.VersioningInterestManager.rebuild | ( | VersionNumber | version, | |
InterestData | datum | |||
) | [protected] |
We received a new version and tried to add it to the given datum, but that datum is too full.
we need to split the interest.
The strategy we use is to keep shifting left. If there is no interest to the left of datum, make one. If there is and it's full, rebuild it, then add our exclusion to the left.
handleContent is synchronized, and the only path to rebuild is from there, so we don't worry about locking too much.
datum | ||
version | may be null for a rebuild w/o insert |
void org.ccnx.ccn.profiles.versioning.VersioningInterestManager.sendInterest | ( | InterestData | id | ) | [protected] |
Send a new interest and manage the _interestMap.
If the InterestData has an old interest, we set the reexpress flag to false it in the map, so it will no longer cause a new interest to be sent and then add the new interest to the map, so when we receive an object for it, we'll issue a new interest.