MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / IsValid

Method IsValid

pkg/utils/parser.go:209–235  ·  view source on GitHub ↗

IsValid checks if the promotion token is valid or returns an error otherwise

()

Source from the content-addressed store, hash-verified

207// IsValid checks if the promotion token is valid or
208// returns an error otherwise
209func (token *PgControldataTokenContent) IsValid() error {
210 if len(token.LatestCheckpointTimelineID) == 0 {
211 return ErrEmptyLatestCheckpointTimelineID
212 }
213
214 if len(token.REDOWALFile) == 0 {
215 return ErrEmptyREDOWALFile
216 }
217
218 if len(token.DatabaseSystemIdentifier) == 0 {
219 return ErrEmptyDatabaseSystemIdentifier
220 }
221
222 if len(token.LatestCheckpointREDOLocation) == 0 {
223 return ErrEmptyLatestCheckpointREDOLocation
224 }
225
226 if len(token.TimeOfLatestCheckpoint) == 0 {
227 return ErrEmptyTimeOfLatestCheckpoint
228 }
229
230 if len(token.OperatorVersion) == 0 {
231 return ErrEmptyOperatorVersion
232 }
233
234 return nil
235}
236
237// Encode encodes the token content into a base64 string
238func (token *PgControldataTokenContent) Encode() (string, error) {

Callers 1

parser_test.goFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected