Documentation
¶
Index ¶
- Constants
- Variables
- func DeflateRulePolicies(in map[string]softwarecomposition.RulePolicy) map[string]softwarecomposition.RulePolicy
- func DeflateSortString(in []string) []string
- func DeflateStringer[T Stringer](in []T) []T
- func DeleteMetadata(conn *sqlite.Conn, path string, metadata runtime.Object) error
- func IsPayloadFile(path string) bool
- func NewConfigurationScanSummaryStorage(realStore StorageQuerier) storage.Interface
- func NewGeneratedNetworkPolicyStorage(realStore StorageQuerier) storage.Interface
- func NewPool(path string, size int) *sqlitemigration.Pool
- func NewTestPool(dir string) *sqlitemigration.Pool
- func NewVulnerabilitySummaryStorage(realStore StorageQuerier) storage.Interface
- func ReadMetadata(conn *sqlite.Conn, path string) ([]byte, error)
- func WriteJSON(conn *sqlite.Conn, path string, metadataJSON []byte) error
- type ApplicationProfileProcessor
- type ConfigurationScanSummaryStorage
- func (ConfigurationScanSummaryStorage) Count(key string) (int64, error)
- func (ConfigurationScanSummaryStorage) Create(_ context.Context, key string, _, _ runtime.Object, _ uint64) error
- func (ConfigurationScanSummaryStorage) Delete(_ context.Context, key string, _ runtime.Object, _ *storage.Preconditions, ...) error
- func (s *ConfigurationScanSummaryStorage) Get(ctx context.Context, key string, _ storage.GetOptions, objPtr runtime.Object) error
- func (s *ConfigurationScanSummaryStorage) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error
- func (ConfigurationScanSummaryStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, ...) error
- func (ConfigurationScanSummaryStorage) RequestWatchProgress(context.Context) error
- func (ConfigurationScanSummaryStorage) Versioner() storage.Versioner
- func (ConfigurationScanSummaryStorage) Watch(_ context.Context, key string, _ storage.ListOptions) (watch.Interface, error)
- type DefaultProcessor
- type DirectIOReader
- type DirectIOWriter
- type GeneratedNetworkPolicyStorage
- func (GeneratedNetworkPolicyStorage) Count(key string) (int64, error)
- func (GeneratedNetworkPolicyStorage) Create(_ context.Context, key string, _, _ runtime.Object, _ uint64) error
- func (GeneratedNetworkPolicyStorage) Delete(_ context.Context, key string, _ runtime.Object, _ *storage.Preconditions, ...) error
- func (s *GeneratedNetworkPolicyStorage) Get(ctx context.Context, key string, opts storage.GetOptions, ...) error
- func (s *GeneratedNetworkPolicyStorage) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error
- func (GeneratedNetworkPolicyStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, ...) error
- func (GeneratedNetworkPolicyStorage) RequestWatchProgress(context.Context) error
- func (GeneratedNetworkPolicyStorage) Versioner() storage.Versioner
- func (GeneratedNetworkPolicyStorage) Watch(_ context.Context, key string, _ storage.ListOptions) (watch.Interface, error)
- type NetworkNeighborhoodProcessor
- type Processor
- type StorageImpl
- func (s *StorageImpl) CalculateChecksum(in runtime.Object) (string, error)
- func (s *StorageImpl) Count(key string) (int64, error)
- func (s *StorageImpl) Create(ctx context.Context, key string, obj, metaOut runtime.Object, _ uint64) error
- func (s *StorageImpl) Delete(ctx context.Context, key string, metaOut runtime.Object, ...) error
- func (s *StorageImpl) Get(ctx context.Context, key string, opts storage.GetOptions, ...) error
- func (s *StorageImpl) GetByCluster(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error
- func (s *StorageImpl) GetByNamespace(ctx context.Context, apiVersion, kind, namespace string, ...) error
- func (s *StorageImpl) GetList(ctx context.Context, key string, opts storage.ListOptions, ...) error
- func (s *StorageImpl) GuaranteedUpdate(ctx context.Context, key string, metaOut runtime.Object, ignoreNotFound bool, ...) error
- func (s *StorageImpl) RequestWatchProgress(context.Context) error
- func (s *StorageImpl) Versioner() storage.Versioner
- func (s *StorageImpl) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error)
- type StorageQuerier
- type Stringer
- type VulnerabilitySummaryStorage
- func (VulnerabilitySummaryStorage) Count(key string) (int64, error)
- func (VulnerabilitySummaryStorage) Create(_ context.Context, key string, _, _ runtime.Object, _ uint64) error
- func (VulnerabilitySummaryStorage) Delete(_ context.Context, key string, _ runtime.Object, _ *storage.Preconditions, ...) error
- func (s *VulnerabilitySummaryStorage) Get(ctx context.Context, key string, _ storage.GetOptions, objPtr runtime.Object) error
- func (s *VulnerabilitySummaryStorage) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error
- func (VulnerabilitySummaryStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, ...) error
- func (VulnerabilitySummaryStorage) RequestWatchProgress(context.Context) error
- func (VulnerabilitySummaryStorage) Versioner() storage.Versioner
- func (VulnerabilitySummaryStorage) Watch(_ context.Context, key string, _ storage.ListOptions) (watch.Interface, error)
Constants ¶
const ( OpenDynamicThreshold = 50 EndpointDynamicThreshold = 100 DefaultMaxApplicationProfileSize = 11000 )
const ( GobExt = ".g" JsonExt = ".j" MetadataExt = ".m" DefaultStorageRoot = "/data" StorageV1Beta1ApiVersion = "spdx.softwarecomposition.seclogic.io/v1beta1" )
const (
DefaultMaxNetworkNeighborhoodSize = 1000
)
Variables ¶
var (
TooLargeObjectError = errors.New("object is too large")
)
Functions ¶
func DeflateRulePolicies ¶
func DeflateRulePolicies(in map[string]softwarecomposition.RulePolicy) map[string]softwarecomposition.RulePolicy
func DeflateSortString ¶
func DeflateStringer ¶
func DeflateStringer[T Stringer](in []T) []T
func DeleteMetadata ¶
func IsPayloadFile ¶
IsPayloadFile returns true if a given file at `path` is an object payload file, else false
func NewConfigurationScanSummaryStorage ¶
func NewConfigurationScanSummaryStorage(realStore StorageQuerier) storage.Interface
func NewGeneratedNetworkPolicyStorage ¶
func NewGeneratedNetworkPolicyStorage(realStore StorageQuerier) storage.Interface
func NewPool ¶
func NewPool(path string, size int) *sqlitemigration.Pool
NewPool creates a new SQLite connection pool at the given path. It returns an error if the connection cannot be opened or the database cannot be initialized. It is your responsibility to call conn.Close() when you no longer need conn.
func NewTestPool ¶
func NewTestPool(dir string) *sqlitemigration.Pool
NewTestPool creates a new temporary SQLite connection (for testing only).
func NewVulnerabilitySummaryStorage ¶
func NewVulnerabilitySummaryStorage(realStore StorageQuerier) storage.Interface
Types ¶
type ApplicationProfileProcessor ¶
type ApplicationProfileProcessor struct {
// contains filtered or unexported fields
}
func NewApplicationProfileProcessor ¶
func NewApplicationProfileProcessor(defaultNamespace string) *ApplicationProfileProcessor
func (*ApplicationProfileProcessor) PreSave ¶
func (a *ApplicationProfileProcessor) PreSave(object runtime.Object) error
func (*ApplicationProfileProcessor) SetStorage ¶
func (a *ApplicationProfileProcessor) SetStorage(storageImpl *StorageImpl)
type ConfigurationScanSummaryStorage ¶
type ConfigurationScanSummaryStorage struct {
// contains filtered or unexported fields
}
ConfigurationScanSummaryStorage offers a storage solution for ConfigurationScanSummary objects, implementing custom business logic for these objects and using the underlying default storage implementation.
func (ConfigurationScanSummaryStorage) Count ¶
Count is not supported for immutable objects. Objects are generated on the fly and not stored.
func (ConfigurationScanSummaryStorage) Create ¶
func (ConfigurationScanSummaryStorage) Create(_ context.Context, key string, _, _ runtime.Object, _ uint64) error
Create is not supported for immutable objects. Objects are generated on the fly and not stored.
func (ConfigurationScanSummaryStorage) Delete ¶
func (ConfigurationScanSummaryStorage) Delete(_ context.Context, key string, _ runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error
Delete is not supported for immutable objects. Objects are generated on the fly and not stored.
func (*ConfigurationScanSummaryStorage) Get ¶
func (s *ConfigurationScanSummaryStorage) Get(ctx context.Context, key string, _ storage.GetOptions, objPtr runtime.Object) error
Get generates and returns a single ConfigurationScanSummary object for a namespace
func (*ConfigurationScanSummaryStorage) GetList ¶
func (s *ConfigurationScanSummaryStorage) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error
GetList generates and returns a list of ConfigurationScanSummary objects for the cluster
func (ConfigurationScanSummaryStorage) GuaranteedUpdate ¶
func (ConfigurationScanSummaryStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error
GuaranteedUpdate is not supported for immutable objects. Objects are generated on the fly and not stored.
func (ConfigurationScanSummaryStorage) RequestWatchProgress ¶
RequestWatchProgress fulfills the storage.Interface
It’s function is only relevant to etcd.
type DefaultProcessor ¶
type DefaultProcessor struct {
}
func (DefaultProcessor) SetStorage ¶
func (d DefaultProcessor) SetStorage(_ *StorageImpl)
type DirectIOReader ¶
type DirectIOReader struct {
// contains filtered or unexported fields
}
DirectIOReader is a reader that reads data from the underlying reader using direct I/O.
func NewDirectIOReader ¶
func NewDirectIOReader(rd io.Reader) *DirectIOReader
func (*DirectIOReader) ReadByte ¶
func (d *DirectIOReader) ReadByte() (byte, error)
type DirectIOWriter ¶
type DirectIOWriter struct {
// contains filtered or unexported fields
}
DirectIOWriter is a writer that writes data to the underlying writer using direct I/O.
func NewDirectIOWriter ¶
func NewDirectIOWriter(wr afero.File) *DirectIOWriter
func (*DirectIOWriter) Close ¶
func (d *DirectIOWriter) Close() error
type GeneratedNetworkPolicyStorage ¶
type GeneratedNetworkPolicyStorage struct {
// contains filtered or unexported fields
}
GeneratedNetworkPolicyStorage offers a storage solution for GeneratedNetworkPolicy objects, implementing custom business logic for these objects and using the underlying default storage implementation.
func (GeneratedNetworkPolicyStorage) Count ¶
Count is not supported for immutable objects. Objects are generated on the fly and not stored.
func (GeneratedNetworkPolicyStorage) Create ¶
func (GeneratedNetworkPolicyStorage) Create(_ context.Context, key string, _, _ runtime.Object, _ uint64) error
Create is not supported for immutable objects. Objects are generated on the fly and not stored.
func (GeneratedNetworkPolicyStorage) Delete ¶
func (GeneratedNetworkPolicyStorage) Delete(_ context.Context, key string, _ runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error
Delete is not supported for immutable objects. Objects are generated on the fly and not stored.
func (*GeneratedNetworkPolicyStorage) Get ¶
func (s *GeneratedNetworkPolicyStorage) Get(ctx context.Context, key string, opts storage.GetOptions, objPtr runtime.Object) error
Get generates and returns a single GeneratedNetworkPolicy object
func (*GeneratedNetworkPolicyStorage) GetList ¶
func (s *GeneratedNetworkPolicyStorage) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error
GetList generates and returns a list of GeneratedNetworkPolicy objects for the given namespace
func (GeneratedNetworkPolicyStorage) GuaranteedUpdate ¶
func (GeneratedNetworkPolicyStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error
GuaranteedUpdate is not supported for immutable objects. Objects are generated on the fly and not stored.
func (GeneratedNetworkPolicyStorage) RequestWatchProgress ¶
RequestWatchProgress fulfills the storage.Interface
It’s function is only relevant to etcd.
type NetworkNeighborhoodProcessor ¶
type NetworkNeighborhoodProcessor struct {
// contains filtered or unexported fields
}
func NewNetworkNeighborhoodProcessor ¶
func NewNetworkNeighborhoodProcessor() *NetworkNeighborhoodProcessor
func (NetworkNeighborhoodProcessor) PreSave ¶
func (a NetworkNeighborhoodProcessor) PreSave(object runtime.Object) error
func (NetworkNeighborhoodProcessor) SetStorage ¶
func (a NetworkNeighborhoodProcessor) SetStorage(_ *StorageImpl)
type Processor ¶
type Processor interface {
PreSave(object runtime.Object) error
SetStorage(storageImpl *StorageImpl)
}
type StorageImpl ¶
type StorageImpl struct {
// contains filtered or unexported fields
}
StorageImpl offers a common interface for object marshaling/unmarshaling operations and hides all the storage-related operations behind it.
func (*StorageImpl) CalculateChecksum ¶
func (s *StorageImpl) CalculateChecksum(in runtime.Object) (string, error)
func (*StorageImpl) Count ¶
func (s *StorageImpl) Count(key string) (int64, error)
Count returns number of different entries under the key (generally being path prefix).
func (*StorageImpl) Create ¶
func (s *StorageImpl) Create(ctx context.Context, key string, obj, metaOut runtime.Object, _ uint64) error
Create adds a new object at a key unless it already exists. 'ttl' is time-to-live in seconds (and is ignored). If no error is returned and out is not nil, out will be set to the read value from database.
func (*StorageImpl) Delete ¶
func (s *StorageImpl) Delete(ctx context.Context, key string, metaOut runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error
Delete removes the specified key and returns the value that existed at that spot. If key didn't exist, it will return NotFound storage error. If 'cachedExistingObject' is non-nil, it can be used as a suggestion about the current version of the object to avoid read operation from storage to get it. However, the implementations have to retry in case suggestion is stale.
func (*StorageImpl) Get ¶
func (s *StorageImpl) Get(ctx context.Context, key string, opts storage.GetOptions, objPtr runtime.Object) error
Get unmarshals object found at key into objPtr. On a not found error, will either return a zero object of the requested type, or an error, depending on 'opts.ignoreNotFound'. Treats empty responses and nil response nodes exactly like a not found error. The returned contents may be delayed, but it is guaranteed that they will match 'opts.ResourceVersion' according 'opts.ResourceVersionMatch'.
func (*StorageImpl) GetByCluster ¶
func (s *StorageImpl) GetByCluster(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error
GetByCluster returns all objects in a given cluster, given their api version and kind.
func (*StorageImpl) GetByNamespace ¶
func (s *StorageImpl) GetByNamespace(ctx context.Context, apiVersion, kind, namespace string, listObj runtime.Object) error
GetByNamespace returns all objects in a given namespace, given their api version and kind.
func (*StorageImpl) GetList ¶
func (s *StorageImpl) GetList(ctx context.Context, key string, opts storage.ListOptions, listObj runtime.Object) error
GetList unmarshalls objects found at key into a *List api object (an object that satisfies runtime.IsList definition). If 'opts.Recursive' is false, 'key' is used as an exact match. If `opts.Recursive' is true, 'key' is used as a prefix. The returned contents may be delayed, but it is guaranteed that they will match 'opts.ResourceVersion' according 'opts.ResourceVersionMatch'. GetList only returns metadata for the objects, not the objects themselves.
func (*StorageImpl) GuaranteedUpdate ¶
func (s *StorageImpl) GuaranteedUpdate( ctx context.Context, key string, metaOut runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, cachedExistingObject runtime.Object) error
GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'destination') retrying the update until success if there is index conflict. Note that object passed to tryUpdate may change across invocations of tryUpdate() if other writers are simultaneously updating it, so tryUpdate() needs to take into account the current contents of the object when deciding how the update object should look. If the key doesn't exist, it will return NotFound storage error if ignoreNotFound=false else `destination` will be set to the zero value of its type. If the eventual successful invocation of `tryUpdate` returns an output with the same serialized contents as the input, it won't perform any update, but instead set `destination` to an object with those contents. If 'cachedExistingObject' is non-nil, it can be used as a suggestion about the current version of the object to avoid read operation from storage to get it. However, the implementations have to retry in case suggestion is stale.
Example:
s := /* implementation of Interface */ err := s.GuaranteedUpdate(
"myKey", &MyType{}, true, preconditions,
func(input runtime.Object, res ResponseMeta) (runtime.Object, *uint64, error) {
// Before each invocation of the user defined function, "input" is reset to
// current contents for "myKey" in database.
curr := input.(*MyType) // Guaranteed to succeed.
// Make the modification
curr.Counter++
// Return the modified object - return an error to stop iterating. Return
// a uint64 to alter the TTL on the object, or nil to keep it the same value.
return cur, nil, nil
}, cachedExistingObject
)
func (*StorageImpl) RequestWatchProgress ¶
func (s *StorageImpl) RequestWatchProgress(context.Context) error
RequestWatchProgress fulfills the storage.Interface
Its function is only relevant to etcd.
func (*StorageImpl) Versioner ¶
func (s *StorageImpl) Versioner() storage.Versioner
Versioner Returns Versioner associated with this interface.
func (*StorageImpl) Watch ¶
func (s *StorageImpl) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error)
Watch begins watching the specified key. Events are decoded into API objects, and any items selected by 'p' are sent down to returned watch.Interface. resourceVersion may be used to specify what version to begin watching, which should be the current resourceVersion, and no longer rv+1 (e.g. reconnecting without missing any updates). If resource version is "0", this interface will get current object at given key and send it in an "ADDED" event, before watch starts.
type StorageQuerier ¶
type StorageQuerier interface {
storage.Interface
CalculateChecksum(in runtime.Object) (string, error)
GetByNamespace(ctx context.Context, apiVersion, kind, namespace string, listObj runtime.Object) error
GetByCluster(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error
}
StorageQuerier wraps the storage.Interface and adds some extra methods which are used by the storage implementation.
func NewStorageImpl ¶
func NewStorageImpl(appFs afero.Fs, root string, pool *sqlitemigration.Pool, scheme *runtime.Scheme) StorageQuerier
func NewStorageImplWithCollector ¶
func NewStorageImplWithCollector(appFs afero.Fs, root string, conn *sqlitemigration.Pool, scheme *runtime.Scheme, processor Processor) StorageQuerier
type VulnerabilitySummaryStorage ¶
type VulnerabilitySummaryStorage struct {
// contains filtered or unexported fields
}
VulnerabilitySummaryStorage implements a storage for vulnerability summaries.
It provides vulnerability summaries for scopes like namespace and cluster. To get these summaries, the storage fetches existing stored VulnerabilitySummary objects and aggregates them on the fly.
func (VulnerabilitySummaryStorage) Count ¶
Count is not supported for immutable objects. Objects are generated on the fly and not stored.
func (VulnerabilitySummaryStorage) Create ¶
func (VulnerabilitySummaryStorage) Create(_ context.Context, key string, _, _ runtime.Object, _ uint64) error
Create is not supported for immutable objects. Objects are generated on the fly and not stored.
func (VulnerabilitySummaryStorage) Delete ¶
func (VulnerabilitySummaryStorage) Delete(_ context.Context, key string, _ runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error
Delete is not supported for immutable objects. Objects are generated on the fly and not stored.
func (*VulnerabilitySummaryStorage) Get ¶
func (s *VulnerabilitySummaryStorage) Get(ctx context.Context, key string, _ storage.GetOptions, objPtr runtime.Object) error
func (*VulnerabilitySummaryStorage) GetList ¶
func (s *VulnerabilitySummaryStorage) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error
func (VulnerabilitySummaryStorage) GuaranteedUpdate ¶
func (VulnerabilitySummaryStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error
GuaranteedUpdate is not supported for immutable objects. Objects are generated on the fly and not stored.
func (VulnerabilitySummaryStorage) RequestWatchProgress ¶
RequestWatchProgress fulfills the storage.Interface
It’s function is only relevant to etcd.