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
[ADDED] Ability to drop partial wildcard tokens in some subject transforms #4152
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…MUST use ALL of the partial wildcards defined in the source of the transform, to only apply for subject transforms used for imports between accounts. Improves transform reverse to support both legacy style wildcards $X and the new transform function {{Wildcard(X)}} Improves reversible transform checking to only allow the use of wildcards in the destination. Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
…n array variable even if that variable's value is nil) Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
… have been allowed in the first place as imported streams and services need to be reversible) Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
server/subject_transform.go
Outdated
@@ -69,7 +69,9 @@ type SubjectTransformer interface { | |||
TransformTokenizedSubject(tokens []string) string | |||
} | |||
|
|||
func NewSubjectTransform(src, dest string) (*subjectTransform, error) { | |||
func NewSubjectTransform(src, dest string, strict bool) (*subjectTransform, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend leaving original and adding in new call that the old one calls with default of false.
func NewSubjectTransform(src, dest string) (*subjectTransform, error) {
return NewSubjectTransformWithStrict(src, dest, false)
}
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
derekcollison
approved these changes
May 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jnmoyne
added a commit
to nats-io/nats-architecture-and-design
that referenced
this pull request
May 16, 2023
jnmoyne
added a commit
to nats-io/nats-architecture-and-design
that referenced
this pull request
Jun 18, 2023
…n the transform (#218) * Update to reflect the new changes from nats-io/nats-server#4152 * PR feedback Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com> * Include per cluster Core NATS subject weighted mappings. Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com> --------- Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
git pull --rebase origin main
)Changes proposed in this pull request:
There is currently a blanket requirement that subject transforms destinations MUST use ALL of the partial wildcards defined in the source of the transform. This is because the subject transformed defined for imports must be 'reversible' and therefore the destination transform must use all of the partial wildcard tokens defined in the source of the transform.
This reversing of a transform is only used for transforms used by imports, where in any case it doesn't make sense to use any transform other than Wildcard.
This PR: