-
Notifications
You must be signed in to change notification settings - Fork 3
Chace managment #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: team_Storage
Are you sure you want to change the base?
Chace managment #19
Conversation
| #include "Cache_Mng.h" | ||
| //get 2 points from Master , return all the images pointers in this range | ||
|
|
||
| int** cache_getImagesPointersInRangeFromMaster(Point_t topLeft, Point_t buttomRight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this to int *
| CacheByImageId_t* cache_ByImageId; | ||
| CacheEmptyAddresses_t* cache_EmptyAddresses; | ||
| CallSource sourceForAPICall; | ||
| int** ram; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to int*
| void ram_initialize(); | ||
|
|
||
| //cache_getRange_internal-get 2 points ,Fetches image pointers in the given range from cache or loads them from disk if not present. | ||
| int ** cache_getRange_internal(Point_t topLeft, Point_t bottomRight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if need to be changed to int *
| int ** cache_getRange_internal(Point_t topLeft, Point_t bottomRight); | ||
|
|
||
| //cache_TreatmentOfReturningAnswers-get images pointers in range,returns to each the requested answer | ||
| int ** cache_TreatmentOfReturningAnswers(Point_t topLeft, Point_t bottomRight,int** imagePointersInCache); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the return to the address of the array
| { | ||
| if (node!=NULL) | ||
| { | ||
| if (node == cache_mng_CB->cache_LRU->head) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write comment
| { | ||
| free(hashInfo); | ||
| } | ||
| void queue_initialize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name
| } | ||
|
|
||
| void hashTable_delete(HashInfo_t* hashInfo) { | ||
| if (hashInfo!=NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert
| void hashTable_delete(HashInfo_t* hashInfo) { | ||
| if (hashInfo!=NULL) | ||
| { | ||
| int index = hashTable_function(hashInfo->imageId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name to hashTableIndex
| void hashTable_delete(HashInfo_t* hashInfo) { | ||
| if (hashInfo!=NULL) | ||
| { | ||
| int index = hashTable_function(hashInfo->imageId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name for the hash table function
| if (hashInfo!=NULL) | ||
| { | ||
| int index = hashTable_function(hashInfo->imageId); | ||
| HashInfo_t* hashInfo1 = cache_mng_CB->cache_ByImageId->entries[index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name : correct entree
| int index = hashTable_function(hashInfo->imageId); | ||
| HashInfo_t* hashInfo1 = cache_mng_CB->cache_ByImageId->entries[index]; | ||
| HashInfo_t* prevHashInfo = NULL; | ||
| while (hashInfo1 != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add function to delete the spesific entree in hash table
| } | ||
| else | ||
| { | ||
| linkedList_moveToHead(hashInfo->linkPointer);//when we access a member in the list, it moves to the top priority (LRU) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment
| void cache_deleteImageByLRU() | ||
| { | ||
| LinkedListNode_t* lruPointer; | ||
| for (int i = 0; i < CACHE_SIZE / 10; i++)//loop on 10% from the tail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moov the calc to out of the loop
| for (int i = 0; i < CACHE_SIZE / 10; i++)//loop on 10% from the tail | ||
| { | ||
| lruPointer = cache_mng_CB->cache_LRU->tail; | ||
| if (lruPointer!=NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert
| } | ||
| HashInfo_t* cache_addImageToTheCacheMapping(int imageId) | ||
| { | ||
| LinkedListNode_t* newLinkedListNode = node_create();//create new node for the linked list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add declaration to all the variables
| cache_mng_CB = (Cache_Management_CB_t*)allocate_memory(sizeof(Cache_Management_CB_t), "Failed to allocate memory for cache control block", Error_When_Allocating_Memory_Space, "cache_initialize_CB"); | ||
| } | ||
|
|
||
| void cache_initialize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain that cache_initialize the data and control
No description provided.