int appendRow(char *name, int shot, int nid, int *bounds, int boundsSize, char *data, int dataSize, _int64 timestamp, int writeMode, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->appendRow(treeIdx, nid, bounds, boundsSize, data, dataSize, timestamp, writeMode); }
int beginTimestampedSegment(char *name, int shot, int nid, int idx, int numItems, char *shape, int shapeSize, char *data, int dataSize, _int64 start, _int64 end, char *dim, int dimSize, int writeThrough, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->beginTimestampedSegment(treeIdx, nid, idx, numItems, shape, shapeSize, data, dataSize, start, end, dim, dimSize, writeThrough); }
int appendTimestampedSegmentData(char *name, int shot, int nid, int *bounds, int boundsSize, char *data, int dataSize, int idx, int startIdx, _int64 *timestamps, int numTimestamps, int writeMode, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->appendTimestampedSegmentData(treeIdx, nid, bounds, boundsSize, data, dataSize, idx, startIdx, timestamps, numTimestamps, writeMode); }
int beginSegment(char *name, int shot, int nid, int idx, char *start, int startSize, char *end, int endSize, char *dim, int dimSize, char *shape, int shapeSize, char *data, int dataSize, int writeThrough, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->beginSegment(treeIdx, nid, idx, start, startSize, end, endSize, dim, dimSize, shape, shapeSize, data, dataSize, writeThrough); }
int getSegmentData(char *name, int shot, int nid, int idx, char **dim, int *dimSize, char **data, int *dataSize,char **shape, int *shapeSize, int *currDataSize, char *timestamped, char *cachePtr) { bool boolTimestamped; int status; int actSamples; TreeDescriptor treeIdx(name, shot); status = ((Cache *)cachePtr)->getSegmentData(treeIdx, nid, idx, dim, dimSize, data, dataSize, shape, shapeSize, currDataSize, &boolTimestamped, &actSamples); *timestamped = (boolTimestamped)?1:0; return status; }
int putRecord(char *name, int shot, int nid, char dataType, int numSamples, char *data, int size, int writeThrough, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->putRecord(treeIdx, nid, dataType, numSamples, data, size, writeThrough); }
int discardData(char *name, int shot, int nid, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->discardData(treeIdx, nid); }
int discardOldSegments(char *name, int shot, int nid, _int64 timestamp, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->discardOldSegments(treeIdx, nid, timestamp); }
int getNumSegments(char *name, int shot, int nid, int *numSegments, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->getNumSegments(treeIdx, nid, numSegments); }
int flushNode(char *name, int shot, int nid, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->flush(treeIdx, nid); }
int flushTree(char *name, int shot, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->flush(treeIdx); }
int isSegmented(char *name, int shot, int nid, int *segmented, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->isSegmented(treeIdx, nid, segmented); }
int getLastSegmentInfo(char *name, int shot, int nid, int **shape, int *shapeSize, int *currDataSize, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->getSegmentInfo(treeIdx, nid, shape, shapeSize, currDataSize); }
int getSegmentLimits(char *name, int shot, int nid, int idx, char **start, int *startSize, char **end, int *endSize, char *timestamped, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->getSegmentLimits(treeIdx, nid, idx, start, startSize, end, endSize, timestamped); }
int getRecord(char *name, int shot, int nid, char *dataType, int *numSamples, char **data, int *size, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->getRecord(treeIdx, nid, dataType, numSamples, data, size); }
void *setCallback(char *name, int shot, int nid, void *argument, void (* callback)(int, void *), void *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->setCallback(treeIdx, nid, argument, callback); }
int clearCallback(char *name, int shot, int nid, char *callbackDescr, void *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->clearCallback(treeIdx, nid, callbackDescr); }
int terminateSegment(char *name, int shot, int nid, char *cachePtr) { TreeDescriptor treeIdx(name, shot); return ((Cache *)cachePtr)->terminateSegment(treeIdx, nid); }
void CoherencyManager::handleMessage(ChannelAddress *senderAddr, int senderIdx, char *buf, int bufLen, char type) //Handle messages from other caches in the system. This is run by a single process on every machine. { switch(type) { case REQUEST_DATA_TYPE: { int nid = channel->toNative(*(unsigned int *)buf); int shotNum = channel->toNative(((int *)buf)[1]); char nameLen = buf[2*sizeof(int)]; char *name = new char[nameLen+1]; memcpy(name, &buf[2*sizeof(int)+1], nameLen); name[nameLen] = 0; TreeDescriptor treeIdx(name, shotNum); handleRequestDataMsg(treeIdx, nid, senderAddr, senderIdx); delete [] name; break; } case OWNERSHIP_TYPE: { int nid = channel->toNative(*(unsigned int *)buf); int shotNum = channel->toNative(((int *)buf)[1]); char nameLen = buf[2*sizeof(int)]; char *name = new char[nameLen+1]; memcpy(name, &buf[2*sizeof(int)+1], nameLen); name[nameLen] = 0; TreeDescriptor treeIdx(name, shotNum); int timestamp = channel->toNative(((unsigned int *)buf)[2]); char ownerIdx = buf[3 * sizeof(int)]; handleOwnershipMsg(treeIdx, nid, timestamp, ownerIdx, senderAddr, senderIdx); delete [] name; break; } case OWNERSHIP_WARM_ACK_TYPE: { int nid = channel->toNative(*(unsigned int *)buf); int shotNum = channel->toNative(((int *)buf)[1]); char nameLen = buf[2*sizeof(int)]; char *name = new char[nameLen+1]; memcpy(name, &buf[2*sizeof(int)+1], nameLen); name[nameLen] = 0; TreeDescriptor treeIdx(name, shotNum); handleOwnershipWarmMessage(treeIdx, nid, senderAddr, senderIdx); delete [] name; break; } case DATA_TYPE: { int nid = channel->toNative(*(unsigned int *)buf); int shotNum = channel->toNative(((int *)buf)[1]); char nameLen = buf[2*sizeof(int)]; char *name = new char[nameLen+1]; memcpy(name, &buf[2*sizeof(int)+1], nameLen); name[nameLen] = 0; TreeDescriptor treeIdx(name, shotNum); handleDataMsg(treeIdx, nid, &buf[2*sizeof(int) + 1 + nameLen], bufLen - (2*sizeof(int) + 1 + nameLen), senderAddr, senderIdx); delete [] name; break; } case DIRTY_TYPE: { int nid = channel->toNative(*(unsigned int *)buf); int shotNum = channel->toNative(((int *)buf)[1]); char nameLen = buf[2*sizeof(int)]; char *name = new char[nameLen+1]; memcpy(name, &buf[2*sizeof(int)+1], nameLen); name[nameLen] = 0; TreeDescriptor treeIdx(name, shotNum); handleDirtyMsg(treeIdx, nid, senderAddr, senderIdx); delete[] name; break; } default: printf("Unsupported message type received: %d\n", type); } }