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

Consider a Read - Modify some Elements - Write Pipeline API #272

Open
suyashkumar opened this issue Apr 23, 2023 · 0 comments
Open

Consider a Read - Modify some Elements - Write Pipeline API #272

suyashkumar opened this issue Apr 23, 2023 · 0 comments

Comments

@suyashkumar
Copy link
Owner

suyashkumar commented Apr 23, 2023

It seems a couple folks are using this library in a Read - Modify Some Elements - Write back out type of pipeline. In this case, if not all elements are inspected or modified, we may be able to optimize writes of those elements that are not modified (without loading them into memory).

If this is a common enough use case where people will benefit from this kind of optimization, we can consider introducing a Mutation API where the user passes in some struct meeting the Mutator (we can reconsider the naming) interface that has a TagsToMutate and Mutate functions to dictate how to modify the tags that need to be modified.

type Mutator interface {
    TagsToMutate tag.Tags
    Mutate(elem *Element) (*Element, error)
}

We may wish to offer the option to also have a TagsToSkip version where elements are sent to Mutate except for those in TagsToSkip.

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

1 participant