Skip to content

Commit

Permalink
schema -> metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
eatpk committed Nov 19, 2023
1 parent 114b2cd commit 515efa3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions analog/storage/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ def __init__(self, mmap_handler):
# Find all chunk indices
self.chunk_indices = self._find_chunk_indices(self.mmap_handler.get_path())

# Add schemas and mmap files for all indices
# Add metadata and mmap files for all indices
for chunk_index in self.chunk_indices:
mmap_filename = f"log_chunk_{chunk_index}.mmap"
self._add_schema_and_mmap(mmap_filename, chunk_index)
self._add_metadata_and_mmap(mmap_filename, chunk_index)

def _find_chunk_indices(self, directory):
chunk_indices = []
Expand All @@ -223,15 +223,15 @@ def _find_chunk_indices(self, directory):
chunk_indices.append(int(chunk_index))
return sorted(chunk_indices)

def _add_schema_and_mmap(
def _add_metadata_and_mmap(
self, mmap_filename, chunk_index
):
# Load the memmap file
mmap, schema = self.mmap_handler.read(mmap_filename)
mmap, metadata = self.mmap_handler.read(mmap_filename)
self.memmaps.append(mmap)

# Update the mapping from data_id to chunk
for entry in schema:
for entry in metadata:
data_id = entry["data_id"]

if data_id in self.data_id_to_chunk:
Expand Down
4 changes: 2 additions & 2 deletions analog/storage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MemoryMapHandler:
def __init__(self, log_dir, mmap_dtype='uint8'):
"""
Args:
save_path (str): The directory of the path to write and read the binaries and the schema.
save_path (str): The directory of the path to write and read the binaries and the metadata.
mmap_dtype: The data type that will be used to save the binary into the memory map.
"""
self.save_path = log_dir
Expand Down Expand Up @@ -77,7 +77,7 @@ def write(self, data_buffer, filename):

def read(self, filename):
"""
read reads the file by chunk index, it will return the data_buffer with schema.
read reads the file by chunk index, it will return the data_buffer with metadata.
Arg:
filename (str): filename for the path to mmap.
Returns:
Expand Down

0 comments on commit 515efa3

Please sign in to comment.