types

package
v0.0.0-...-5bcb16e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Cmp

type Cmp *int

func CmpEqual

func CmpEqual() Cmp

func CmpLess

func CmpLess() Cmp

func CmpMore

func CmpMore() Cmp

type ComparablePredicate

type ComparablePredicate[T any] interface {
	Compare(T) Cmp
}

type EncodeFunc

type EncodeFunc func(any) error

type ExportableStatement

type ExportableStatement interface {
	GetType() string
	GetPredicate() any
	ExportSubject() []toto.Subject
	Export() toto.Statement
}

type GenericStatement

type GenericStatement[T any] struct {
	Subjects Subjects `json:"subject"`
	Predicate[T]
}

func MakeStatement

func MakeStatement[T any](predicateType string, predicate ComparablePredicate[T], subjects ...Subject) GenericStatement[T]

func (GenericStatement[T]) Compare

func (a GenericStatement[T]) Compare(b Statement) Cmp

func (GenericStatement[T]) Encode

func (s GenericStatement[T]) Encode(w io.Writer) error

func (GenericStatement[T]) EncodeWith

func (s GenericStatement[T]) EncodeWith(e EncodeFunc) error

func (GenericStatement[T]) Export

func (s GenericStatement[T]) Export() toto.Statement

func (GenericStatement[T]) ExportSubject

func (s GenericStatement[T]) ExportSubject() []toto.Subject

func (GenericStatement[T]) GetSubject

func (s GenericStatement[T]) GetSubject() Subjects

func (*GenericStatement[T]) SetSubjects

func (s *GenericStatement[T]) SetSubjects(f func(subject *Subject) error) error

type Mutations

type Mutations = map[PathCheckerRegistryKey]digest.SHA256

type PathCheckSummary

type PathCheckSummary interface {
	ProviderName() string
	Common() PathCheckSummaryCommon
	Full() interface{}
	SameRepo(PathCheckSummary) bool
}

type PathCheckSummaryCollection

type PathCheckSummaryCollection struct {
	Providers   []string             `json:"providers"`
	EntryGroups [][]PathCheckSummary `json:"entryGroups"`
}

func MakePathCheckSummaryCollection

func MakePathCheckSummaryCollection(entries ...PathChecker) (*PathCheckSummaryCollection, error)

func (PathCheckSummaryCollection) Compare

func (PathCheckSummaryCollection) Subject

type PathCheckSummaryCommon

type PathCheckSummaryCommon struct {
	Unmodified bool          `json:"unmodified"`
	Path       string        `json:"path,omitempty"`
	URI        string        `json:"uri,omitempty"`
	IsDir      bool          `json:"isDir,omitempty"`
	Digest     digest.SHA256 `json:"digest,omitempty"`
}

func (PathCheckSummaryCommon) Common

type PathChecker

type PathChecker interface {
	ProviderName() string
	DetectRepo() (bool, error)
	Check() (bool, bool, error)
	MakeSummary() (PathCheckSummary, error)
}

type PathCheckerRegistryKey

type PathCheckerRegistryKey struct {
	Path   string
	Digest digest.SHA256
}

type Predicate

type Predicate[T any] struct {
	Type                   string `json:"predicateType"`
	ComparablePredicate[T] `json:"predicate"`
}

func (Predicate[T]) Compare

func (p Predicate[T]) Compare(b any) Cmp

func (Predicate[T]) GetPredicate

func (p Predicate[T]) GetPredicate() any

func (Predicate[T]) GetType

func (p Predicate[T]) GetType() string

type Statement

type Statement interface {
	ExportableStatement

	GetSubject() Subjects
	Encode(io.Writer) error
	EncodeWith(EncodeFunc) error
	SetSubjects(func(*Subject) error) error
	Compare(Statement) Cmp
}

type Statements

type Statements []Statement

func (Statements) Encode

func (s Statements) Encode(w io.Writer) error

func (Statements) EncodeWith

func (s Statements) EncodeWith(encoder EncodeFunc) error

func (Statements) Export

func (s Statements) Export() []toto.Statement

func (Statements) MakeSummaryAnnotation

func (s Statements) MakeSummaryAnnotation() SummaryAnnotation

func (Statements) MarshalSummaryAnnotation

func (s Statements) MarshalSummaryAnnotation() (string, error)

type Subject

type Subject struct {
	Name   string        `json:"name"`
	Digest digest.SHA256 `json:"digest"`
}

func MakeSubject

func MakeSubject(name string, digest digest.SHA256) Subject

func (Subject) Export

func (s Subject) Export() []toto.Subject

func (Subject) GetSubjectDigest

func (s Subject) GetSubjectDigest() digest.SHA256

func (Subject) GetSubjectName

func (s Subject) GetSubjectName() string

func (Subject) MarshalJSON

func (s Subject) MarshalJSON() ([]byte, error)

func (*Subject) UnmarshalJSON

func (s *Subject) UnmarshalJSON(data []byte) error

type Subjects

type Subjects []Subject

func MakeSubjects

func MakeSubjects(subjects ...Subject) Subjects

func (Subjects) Export

func (s Subjects) Export() []toto.Subject

func (Subjects) MarshalJSON

func (s Subjects) MarshalJSON() ([]byte, error)

func (*Subjects) UnmarshalJSON

func (s *Subjects) UnmarshalJSON(data []byte) error

type SummaryAnnotation

type SummaryAnnotation struct {
	NumStamentes   int      `json:"numStamentes"`
	PredicateTypes []string `json:"predicateTypes"`
	Subjects       Subjects `json:"subject"`
}

func UnmarshalSummaryAnnotation

func UnmarshalSummaryAnnotation(s string) (*SummaryAnnotation, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL