github.com/google/osv-scalibr@v0.4.1/extractor/filesystem/containers/containerd/containerd_dummy.go (about)

     1  // Copyright 2025 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  //go:build !linux
    16  
    17  // Package containerd extracts container inventory from containerd metadb database.
    18  package containerd
    19  
    20  import (
    21  	"context"
    22  	"errors"
    23  
    24  	"github.com/google/osv-scalibr/extractor/filesystem"
    25  	"github.com/google/osv-scalibr/inventory"
    26  	"github.com/google/osv-scalibr/plugin"
    27  )
    28  
    29  // Name is the name for the extractor
    30  const Name = "containers/containerd"
    31  
    32  // Extractor struct.
    33  type Extractor struct{}
    34  
    35  // Config struct
    36  type Config struct {
    37  	// MaxMetaDBFileSize is the maximum file size an extractor will unmarshal.
    38  	// If Extract gets a bigger file, it will return an error.
    39  	MaxMetaDBFileSize int64
    40  }
    41  
    42  // DefaultConfig returns the default configuration values.
    43  func DefaultConfig() Config { return Config{} }
    44  
    45  // New returns an extractor.
    46  func New(cfg Config) *Extractor {
    47  	return &Extractor{}
    48  }
    49  
    50  // NewDefault returns an extractor with the default config settings.
    51  func NewDefault() filesystem.Extractor { return New(DefaultConfig()) }
    52  
    53  // Name of the extractor.
    54  func (e Extractor) Name() string { return Name }
    55  
    56  // Version of the extractor.
    57  func (e Extractor) Version() int { return 0 }
    58  
    59  // Requirements of the extractor.
    60  func (e Extractor) Requirements() *plugin.Capabilities { return &plugin.Capabilities{} }
    61  
    62  // FileRequired always returns false.
    63  func (e Extractor) FileRequired(_ filesystem.FileAPI) bool {
    64  	return false
    65  }
    66  
    67  // Extract not implemented.
    68  func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) (inventory.Inventory, error) {
    69  	return inventory.Inventory{}, errors.New("not supported")
    70  }