github.com/azunymous/cdx@v0.0.0-20201122180449-fbb46cc4d252/versioned/versioned.go (about)

     1  // Package versioned provides the versioned interface and semantic versioning constants
     2  package versioned
     3  
     4  // Versioned describes a system that can be versioned and promoted between different 'gates'
     5  type Versioned interface {
     6  	// Ready verifies that the system can be operated on and versioned correctly.
     7  	Ready() bool
     8  
     9  	// Release increments the version.
    10  	Release() error
    11  	// Promote promotes the current version to a new stage - moving past a 'gate'.
    12  	Promote(stage string) error
    13  	// Version returns the highest version. Varying at what it looks at depending on the optional provided modifiers.
    14  	Version(stage string, headOnly bool, useHash bool) (string, error)
    15  
    16  	// Distribute distributes the current state of the system to remotes.
    17  	Distribute() error
    18  }
    19  
    20  // Semantic version field - X.Y.Z
    21  type Field int32
    22  
    23  const (
    24  	Major Field = 0 // X
    25  	Minor Field = 1 // Y
    26  	Patch Field = 2 // Z
    27  )