Skip to content

[C API] Copy columns out of kastore #506

@jeromekelleher

Description

@jeromekelleher

Currently when a tsk_table_collection is read from file, it uses the kastore object as the backing memory. That is, we have a self->store pointer which we maintain for the lifetime of the table collection, and the table columns all point directly to the store's memory. This setup was motivated by a desire to use mmap within the kastore and therefore have zero copy semantics all the way down to the kernel for column memory. Turns out this isn't worth the complexity, as mmap use has a few major caveats and the files just aren't large enough to make this sort of optimisation worthwhile.

So, we should move to copying the columns out of the store. We should set this up so that we read the columns into a set of local pointers, and then call (e.g.) tsk_node_table_set_columns with those pointers as arguments. This will take care of all the allocation behaviour, and make sure that the NULL column semantics accepted for set_columns is directly reflected also in the default columns from file. It's probably a straightforward change where we provide pointers to local variables rather than the table columns to read_table_cols, and then call set_columns on those.

What do you think @benjeffery?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions