Coder Social home page Coder Social logo

Change iterators API about pmemstream HOT 7 CLOSED

pmem avatar pmem commented on September 25, 2024 1
Change iterators API

from pmemstream.

Comments (7)

igchor avatar igchor commented on September 25, 2024

pmemstream_entry_iterator_get could actually just return pmemstream_entry by value. Its precondition is pmemstream_entry_iterator_is_valid() == 0 anyway, right?

from pmemstream.

karczex avatar karczex commented on September 25, 2024

It's right as long as you cannot remove region when region or entry iterator points to it. IMO, we may do it this way.

from pmemstream.

igchor avatar igchor commented on September 25, 2024

Yes, the idea is that iterator will block removal. If it would not, we would not have any way of detecting this anyway I think.

from pmemstream.

KFilipek avatar KFilipek commented on September 25, 2024

What's the correct behavior for:

struct pmemstream_region pmemstream_region_iterator_get(struct pmemstream_region_iterator *iterator, struct pmemstream_region *region);

when:

void invalid_region_test(char *path)
{
	pmemstream_test_env env = pmemstream_test_make_default(path);

	const uint64_t invalid_offset = ALIGN_DOWN(UINT64_MAX, sizeof(span_bytes));
	struct pmemstream_region_iterator *riter = NULL;
	struct pmemstream_region invalid_region = {.offset = invalid_offset};

	int ret = pmemstream_region_iterator_new(&riter, env.stream);
	UT_ASSERTeq(ret, 0);
	UT_ASSERTne(riter, NULL);

	pmemstream_region_iterator_seek_first(riter);

	invalid_region = pmemstream_region_iterator_get(riter);
	UT_ASSERTeq(invalid_region.offset, invalid_offset); // HERE

	pmemstream_region_iterator_delete(&riter);
	pmemstream_test_teardown(env);
}

from pmemstream.

lukaszstolarczuk avatar lukaszstolarczuk commented on September 25, 2024

the above question is resolved now - an invalid region is just returned from get and such region can always be checked by pmemstream_entry_iterator_is_valid function.

// region part is done in #186

from pmemstream.

igchor avatar igchor commented on September 25, 2024

@lukaszstolarczuk why this is closed? entry iterator API is not done yet, right?

from pmemstream.

lukaszstolarczuk avatar lukaszstolarczuk commented on September 25, 2024

yeah, for some reason GH closed this (the commit has a reference to this issue).

from pmemstream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.