You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.
The fact the particular entry is located in the particular region which is part of particular stream instance should be reflected in API.
Currently functions in pmemstream unnecessary gets to many arguments. i.e: int pmemstream_append(struct pmemstream *stream, struct pmemstream_region region, struct pmemstream_region_runtime *region_runtime, const void *data, size_t size, struct pmemstream_entry *new_entry) which is error prone. It's super easy to pass mismatched entry, region and region runtime.
Description
Make region and entry structures purely runtime.
Use pointers to regions and entries instead of offsets (allow to remove a lot of offset_to_ptr calls).
Add serialization/deserialization functions, which would operate on offsets.
Those functions are needed to store as a separate metadata not related to actual address
size_tpmemstream_region_offset(conststructpmemstream_region);
size_tpmemstream_entry_offset(conststructpmemsream_entry);
intpmemstream_reigon_from_offset(size_toffset, structpmemstream_region*region); // Check if it's region is needed, so need to read metadata from pmemintpmemstream_entry_from_offset(size_toffset, struct*pmemstream_entry); // Check if it's entry is needed, so need to read metadata from pmem
Implementation details
Change structures pmemstream_region and pmemstream_entry to be purely runtime and operate on pointers instead of offsets
/* Runtime structure */structpmemstream_region {
structpmemstream*stream;
structpmemstream_region_runtime*region_runtime;
/* Pointer to region on pmem */void*data;
};
/* Runtime structure */structpmemstream_entry {
structpmemstream_regionregion;
/* raw pointer to entry on pmem */void*data;
/* possible optimization: store in runtime structure size and timestamp to minimize entry metadata * reads from pmem */size_tsize;
uint64_ttimestamp;
};
The text was updated successfully, but these errors were encountered:
Perhaps functions that take region as the first parameter should have pmemstream_region prefix? E.g. pmemstream_region_append instead of pmemstream_append?
Instead of extending/changing reserve/publish function we might think about creating some more general transactional API, so that publish can actually publish multiple entries at once. Something like this perhaps:
But I'm not sure if this is the best idea. Currently, publish stores all the metadata, so if we could like to do that on tx_commit we would need to keep some list of entries inside tx.
There should be no dynamic allocations for pmemstream_region nor pmemstream_entry. pmemstream_entry should hold region directly, not a pointer to it.
Perhaps functions that take region as the first parameter should have pmemstream_region prefix? E.g. pmemstream_region_append instead of pmemstream_append?
I think it may be misleading - one would think that you want to "append a new region to stream" 😉 I think it's ok, like @karczex proposed.
FEAT: Simplify pmemstream API
Rationale
The fact the particular entry is located in the particular region which is part of particular stream instance should be reflected in API.
Currently functions in pmemstream unnecessary gets to many arguments. i.e:
int pmemstream_append(struct pmemstream *stream, struct pmemstream_region region, struct pmemstream_region_runtime *region_runtime, const void *data, size_t size, struct pmemstream_entry *new_entry)
which is error prone. It's super easy to pass mismatched entry, region and region runtime.Description
API Changes
Signature change
Functions to be removed
pmemstream_region_runtime_initialize()
Functions to be added
Those functions are needed to store as a separate metadata not related to actual address
Implementation details
Change structures
pmemstream_region
andpmemstream_entry
to be purely runtime and operate on pointers instead of offsetsThe text was updated successfully, but these errors were encountered: