-
Notifications
You must be signed in to change notification settings - Fork 63
/
package.go
55 lines (40 loc) · 1.42 KB
/
package.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors.
// Licensed under the BSD-3-Clause License (the "License").
// You may not use this file except in compliance with the License.
package pack
import (
"context"
"fmt"
"time"
"kraftkit.sh/internal/tableprinter"
"kraftkit.sh/unikraft"
)
type PackageFormat string
var _ fmt.Stringer = (*PackageFormat)(nil)
func (pf PackageFormat) String() string {
return string(pf)
}
type Package interface {
unikraft.Nameable
// Metadata returns any additional metadata associated with this package.
Metadata() interface{}
// Columns is a subset of Metadata that is displayed to the user and can be
// also collated or parsed to made easier-to-read.
Columns() []tableprinter.Column
// Push the package to a remotely retrievable destination.
Push(context.Context, ...PushOption) error
// Pull retreives the package from a remotely retrievable location.
Pull(context.Context, ...PullOption) error
// Unpack the package into the specified directory.
Unpack(context.Context, string) error
// Save the state of package.
Save(context.Context) error
// Deletes package available locally.
Delete(context.Context) error
// PulledAt is an attribute of a package to indicate when (and if) it was
// last retrieved.
PulledAt(context.Context) (bool, time.Time, error)
// Format returns the name of the implementation.
Format() PackageFormat
}