Skip to content

Chace managment#19

Open
shifi325 wants to merge 2 commits into
team_Storagefrom
chace_managment
Open

Chace managment#19
shifi325 wants to merge 2 commits into
team_Storagefrom
chace_managment

Conversation

@shifi325
Copy link
Copy Markdown
Collaborator

No description provided.

@shifi325 shifi325 changed the base branch from main to team_Storage September 12, 2024 19:54
Comment thread Storage/Cache_Mng_API.h
@shifi325 shifi325 requested a review from sariDaitch September 12, 2024 19:57
Comment thread Storage/Cache_Mng_API.h
#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
Copy Markdown
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 *

Comment thread Storage/Cache_Mng.h
Comment thread Storage/Cache_Mng.h
Comment thread Storage/Cache_Mng.h
CacheByImageId_t* cache_ByImageId;
CacheEmptyAddresses_t* cache_EmptyAddresses;
CallSource sourceForAPICall;
int** ram;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to int*

Comment thread Storage/Cache_Mng.h
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
Copy Markdown
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 *

Comment thread Storage/Cache_Mng.h
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
Copy Markdown
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

Comment thread Storage/Cache_Mng.h
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
{
if (node!=NULL)
{
if (node == cache_mng_CB->cache_LRU->head) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write comment

Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
{
free(hashInfo);
}
void queue_initialize()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the name

Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
Comment thread Storage/Cache_Mng.c
}

void hashTable_delete(HashInfo_t* hashInfo) {
if (hashInfo!=NULL)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert

Comment thread Storage/Cache_Mng.c
void hashTable_delete(HashInfo_t* hashInfo) {
if (hashInfo!=NULL)
{
int index = hashTable_function(hashInfo->imageId);
Copy link
Copy Markdown
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

Comment thread Storage/Cache_Mng.c
void hashTable_delete(HashInfo_t* hashInfo) {
if (hashInfo!=NULL)
{
int index = hashTable_function(hashInfo->imageId);
Copy link
Copy Markdown
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

Comment thread Storage/Cache_Mng.c
if (hashInfo!=NULL)
{
int index = hashTable_function(hashInfo->imageId);
HashInfo_t* hashInfo1 = cache_mng_CB->cache_ByImageId->entries[index];
Copy link
Copy Markdown
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

Comment thread Storage/Cache_Mng.c
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
Copy Markdown
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

Comment thread Storage/Cache_Mng.c
}
else
{
linkedList_moveToHead(hashInfo->linkPointer);//when we access a member in the list, it moves to the top priority (LRU)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment

Comment thread Storage/Cache_Mng.c
void cache_deleteImageByLRU()
{
LinkedListNode_t* lruPointer;
for (int i = 0; i < CACHE_SIZE / 10; i++)//loop on 10% from the tail
Copy link
Copy Markdown
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

Comment thread Storage/Cache_Mng.c
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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert

Comment thread Storage/Cache_Mng.c
}
HashInfo_t* cache_addImageToTheCacheMapping(int imageId)
{
LinkedListNode_t* newLinkedListNode = node_create();//create new node for the linked list
Copy link
Copy Markdown
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

Comment thread Storage/Cache_Mng.c
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
Copy Markdown
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.

2 participants