Skip to content

Conversation

@shifi325
Copy link
Collaborator

No description provided.

@shifi325 shifi325 changed the base branch from main to team_Storage September 12, 2024 19:54
@shifi325 shifi325 requested a review from sariDaitch September 12, 2024 19:57
#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);
Copy link
Collaborator

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;
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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) {
Copy link
Collaborator

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()
Copy link
Collaborator

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)
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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];
Copy link
Collaborator

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)
Copy link
Collaborator

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)
Copy link
Collaborator

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
Copy link
Collaborator

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)
Copy link
Collaborator

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
Copy link
Collaborator

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()
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants