Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is SeqWrap for? #29

Open
KyleMaas opened this issue Jan 23, 2023 · 4 comments
Open

What is SeqWrap for? #29

KyleMaas opened this issue Jan 23, 2023 · 4 comments

Comments

@KyleMaas
Copy link

I have yet to see a Margaret query in go-ssb that doesn't use SeqWrap. What is the purpose of it, and why isn't it the default (or only option) if that's the way it's always used?

@decentral1se
Copy link
Member

@KyleMaas afaiu when querying the log, instead of having to first get back a list of sequence numbers and then query the log again to pull out the items, Seqwrap brings back both the sequence number and item in one query?

margaret/qry.go

Lines 29 to 31 in 4f58150

// SeqWrap makes the source return values that contain both the item and its
// sequence number, instead of the item alone.
SeqWrap(bool) error

@KyleMaas
Copy link
Author

@decentral1se

Is there a situation where you would not want this behavior? I don't think I've seen anything that doesn't use this.

@decentral1se
Copy link
Member

@KyleMaas I'm not sure but I guess we could imagine a scenario where only grabbing the sequence number is less overhead for the query caller. Are you looking to remap this API surface or? Definitely wanna find time to do a docs sprint here...

@KyleMaas
Copy link
Author

@decentral1se

I've spotted several opportunities for race conditions which can corrupt things when SeqWrap is used. Just trying to understand it better.

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

No branches or pull requests

2 participants