Skip to content

Commit

Permalink
Extend ClickHouse source model with deletable flag
Browse files Browse the repository at this point in the history
- Add `IsDeleteable` field to `ChSource` struct
- Implement `IsDeleteable()` method for `ChSourceWrapper`
- Add `ToSinkParams()` method to create a copy of source with deletable flag set to false by default
  • Loading branch information
laskoviymishka committed Feb 25, 2025
1 parent 758a091 commit af16a19
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/providers/clickhouse/model/model_ch_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type ChSource struct {
BufferSize uint64
IOHomoFormat ClickhouseIOFormat // one of - https://clickhouse.com/docs/en/interfaces/formats
RootCACertPaths []string
IsDeleteable bool
}

func (s *ChSource) Describe() model.Doc {
Expand Down Expand Up @@ -346,3 +347,17 @@ func (s ChSourceWrapper) SetShards(shards map[string][]string) {
})
}
}

func (s ChSourceWrapper) IsDeleteable() bool {
return s.Model.IsDeleteable
}

func (s *ChSource) ToSinkParams() ChSourceWrapper {
copyChSource := *s
copyChSource.IsDeleteable = false // По умолчанию false для source
return ChSourceWrapper{
Model: &copyChSource,
host: "",
altHosts: nil,
}
}

0 comments on commit af16a19

Please sign in to comment.