Skip to content

Commit

Permalink
Implements the nats-server PR feedback changes as it is now merged in…
Browse files Browse the repository at this point in the history
…to dev
  • Loading branch information
jnmoyne committed Aug 2, 2023
1 parent eef296f commit d2e6f11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions jetstream/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (js *jetStream) CreateStream(ctx context.Context, cfg StreamConfig) (Stream
if cfg.Sources[i].SubjectTransformDest != _EMPTY_ && resp.Sources[i].SubjectTransformDest == _EMPTY_ {
return nil, ErrStreamSourceSubjectTransformNotSupported
}
if len(cfg.Sources[i].FilterSubjects) != 0 && len(resp.Sources[i].FilterSubjects) == 0 {
if len(cfg.Sources[i].SubjectTransforms) != 0 && len(resp.Sources[i].SubjectTransforms) == 0 {
return nil, ErrStreamSourceMultipleFilterSubjectsNotSupported
}
}
Expand Down Expand Up @@ -437,7 +437,7 @@ func (js *jetStream) UpdateStream(ctx context.Context, cfg StreamConfig) (Stream
if cfg.Sources[i].SubjectTransformDest != _EMPTY_ && resp.Sources[i].SubjectTransformDest == _EMPTY_ {
return nil, ErrStreamSourceSubjectTransformNotSupported
}
if len(cfg.Sources[i].FilterSubjects) != 0 && len(resp.Sources[i].FilterSubjects) == 0 {
if len(cfg.Sources[i].SubjectTransforms) != 0 && len(resp.Sources[i].SubjectTransforms) == 0 {
return nil, ErrStreamSourceMultipleFilterSubjectsNotSupported
}
}
Expand Down
32 changes: 15 additions & 17 deletions jetstream/stream_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ type (

// StreamSourceInfo shows information about an upstream stream source.
StreamSourceInfo struct {
Name string `json:"name"`
Lag uint64 `json:"lag"`
Active time.Duration `json:"active"`
FilterSubject string `json:"filter_subject,omitempty"`
SubjectTransformDest string `json:"subject_transform_dest,omitempty"`
FilterSubjects []string `json:"filter_subjects,omitempty"`
SubjectTransformDests []string `json:"subject_transform_dests,omitempty"`
Name string `json:"name"`
Lag uint64 `json:"lag"`
Active time.Duration `json:"active"`
FilterSubject string `json:"filter_subject,omitempty"`
SubjectTransformDest string `json:"subject_transform_dest,omitempty"`
SubjectTransforms []SubjectTransformConfig `json:"subject_transforms,omitempty"`
}

// StreamState is information about the given stream.
Expand Down Expand Up @@ -118,7 +117,7 @@ type (

// SubjectTransformConfig is for applying a subject transform (to matching messages) before doing anything else when a new message is received
SubjectTransformConfig struct {
Source string `json:"src,omitempty"`
Source string `json:"src"`
Destination string `json:"dest"`
}

Expand All @@ -138,15 +137,14 @@ type (

// StreamSource dictates how streams can source from other streams.
StreamSource struct {
Name string `json:"name"`
OptStartSeq uint64 `json:"opt_start_seq,omitempty"`
OptStartTime *time.Time `json:"opt_start_time,omitempty"`
FilterSubject string `json:"filter_subject,omitempty"`
SubjectTransformDest string `json:"subject_transform_dest,omitempty"`
FilterSubjects []string `json:"filter_subjects,omitempty"`
SubjectTransformDests []string `json:"subject_transform_dests,omitempty"`
External *ExternalStream `json:"external,omitempty"`
Domain string `json:"-"`
Name string `json:"name"`
OptStartSeq uint64 `json:"opt_start_seq,omitempty"`
OptStartTime *time.Time `json:"opt_start_time,omitempty"`
FilterSubject string `json:"filter_subject,omitempty"`
SubjectTransformDest string `json:"subject_transform_dest,omitempty"`
SubjectTransforms []SubjectTransformConfig `json:"subject_transforms,omitempty"`
External *ExternalStream `json:"external,omitempty"`
Domain string `json:"-"`
}

// ExternalStream allows you to qualify access to a stream source in another
Expand Down

0 comments on commit d2e6f11

Please sign in to comment.