diff --git a/README.md b/README.md index 3228b802..ef3f3291 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The specification provides similar capabilities as that of the Docker Registry H ## Why OpenRegistry? For the longest time, we have relied on DockerHub to host and distribute our container images (both private and public). OpenRegistry tries to provide a decentralized alternative to that by running a community driven container registry, for People by People. -OpenRegitry uses AkashNetwork as it's compute layer and SkyNet for storage. Since AkashNetwork provides a spot like compute market, fault tolerance, Scalability and Resiliency are our priorities from day one. +OpenRegitry uses [Akash Network](https://akash.network) as it's compute layer and IPFS, Filebase, or Storj for storage. Since AkashNetwork provides a spot like compute market, fault tolerance, Scalability and Resiliency are our priorities from day one. ## Getting Started Working with OpenRegistry is no different than working with any other container registry. Following are the steps to get started: diff --git a/config.example.yaml b/config.example.yaml index 175da795..f836a35f 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -20,7 +20,6 @@ registry: services: - github - token - - skynet_homescreen auth: enabled: false priv_key: .certs/registry.local diff --git a/config/config.go b/config/config.go index d31e74a7..f39dac4a 100644 --- a/config/config.go +++ b/config/config.go @@ -17,7 +17,6 @@ import ( type ( OpenRegistryConfig struct { - SkynetConfig Skynet `yaml:"skynet" mapstructure:"skynet" validate:"-"` WebAppConfig WebAppConfig `yaml:"web_app" mapstructure:"web_app"` OAuth OAuth `yaml:"oauth" mapstructure:"oauth" validate:"-"` StoreConfig Store `yaml:"database" mapstructure:"database" validate:"required"` @@ -88,13 +87,6 @@ type ( Enabled bool `yaml:"enabled" mapstructure:"enabled"` } - Skynet struct { - SkynetPortalURL string `yaml:"portal_url" mapstructure:"portal_url" validate:"-"` - EndpointPath string `yaml:"endpoint_path" mapstructure:"endpoint_path"` - ApiKey string `yaml:"api_key" mapstructure:"api_key"` - CustomUserAgent string `yaml:"custom_user_agent" mapstructure:"custom_user_agent"` - } - Log struct { Service string `yaml:"name" mapstructure:"name"` Endpoint string `yaml:"endpoint" mapstructure:"endpoint"` diff --git a/db/migrations/000002_create_blob_table.up.sql b/db/migrations/000002_create_blob_table.up.sql index 492824d1..c2ddadeb 100644 --- a/db/migrations/000002_create_blob_table.up.sql +++ b/db/migrations/000002_create_blob_table.up.sql @@ -1,7 +1,7 @@ CREATE TABLE "blob" ( "uuid" uuid, "digest" text PRIMARY KEY, - "sky_link" text, + "dfs_link" text, "start_range" int, "end_range" int, "created_at" timestamp, diff --git a/db/migrations/000003_create_layer_table.up.sql b/db/migrations/000003_create_layer_table.up.sql index b81cee6f..86ba7d83 100644 --- a/db/migrations/000003_create_layer_table.up.sql +++ b/db/migrations/000003_create_layer_table.up.sql @@ -3,7 +3,7 @@ CREATE TABLE "layer" ( "digest" text UNIQUE NOT NULL, "blob_ids" text[], "media_type" text, - "sky_link" text, + "dfs_link" text, "size" int, "created_at" timestamp, "updated_at" timestamp diff --git a/db/migrations/000004_create_config_table.up.sql b/db/migrations/000004_create_config_table.up.sql index 344e5b0b..042388a4 100644 --- a/db/migrations/000004_create_config_table.up.sql +++ b/db/migrations/000004_create_config_table.up.sql @@ -3,7 +3,7 @@ CREATE TABLE "config" ( "namespace" text NOT NULL, "reference" text NOT NULL, "digest" text NOT NULL, - "sky_link" text, + "dfs_link" text, "media_type" text, "layers" text[], "size" int, diff --git a/db/migrations/000013_create_repository_table.up.sql b/db/migrations/000013_create_repository_table.up.sql index 95c53c77..94985e0e 100644 --- a/db/migrations/000013_create_repository_table.up.sql +++ b/db/migrations/000013_create_repository_table.up.sql @@ -1,7 +1,7 @@ CREATE TABLE "repositori" ( "uuid" uuid, "digest" text PRIMARY KEY, - "sky_link" text, + "dfs_link" text, "start_range" int, "end_range" int, "created_at" timestamp diff --git a/dfs/dfs.go b/dfs/dfs.go index 79d1ca1f..bc465e07 100644 --- a/dfs/dfs.go +++ b/dfs/dfs.go @@ -4,10 +4,9 @@ import ( "context" "io" - "github.com/SkynetLabs/go-skynet/v2" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/containerish/OpenRegistry/config" - "github.com/containerish/OpenRegistry/types" + "github.com/containerish/OpenRegistry/store/v2/types" ) type DFS interface { @@ -34,10 +33,10 @@ type DFS interface { completedParts []s3types.CompletedPart, ) (string, error) Download(ctx context.Context, path string) (io.ReadCloser, error) - DownloadDir(skynetLink, dir string) error + DownloadDir(dfsLink, dir string) error List(path string) ([]*types.Metadata, error) AddImage(ns string, mf, l map[string][]byte) (string, error) - Metadata(skylink string) (*skynet.Metadata, error) + Metadata(dfsLink string) (*types.ObjectMetadata, error) GetUploadProgress(identifier, uploadID string) (*types.ObjectMetadata, error) AbortMultipartUpload(ctx context.Context, layerKey string, uploadId string) error GeneratePresignedURL(ctx context.Context, key string) (string, error) diff --git a/dfs/filebase/filebase.go b/dfs/filebase/filebase.go index dc5c97b0..c5540748 100644 --- a/dfs/filebase/filebase.go +++ b/dfs/filebase/filebase.go @@ -7,13 +7,12 @@ import ( "io" "time" - "github.com/SkynetLabs/go-skynet/v2" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/containerish/OpenRegistry/config" "github.com/containerish/OpenRegistry/dfs" - "github.com/containerish/OpenRegistry/types" + "github.com/containerish/OpenRegistry/store/v2/types" "github.com/opencontainers/go-digest" ) @@ -208,7 +207,7 @@ func (fb *filebase) Download(ctx context.Context, path string) (io.ReadCloser, e return resp.Body, nil } -func (fb *filebase) DownloadDir(skynetLink, dir string) error { +func (fb *filebase) DownloadDir(dfsLink, dir string) error { return nil } func (fb *filebase) List(path string) ([]*types.Metadata, error) { @@ -221,7 +220,7 @@ func (fb *filebase) AddImage(ns string, mf, l map[string][]byte) (string, error) // Metadata API returns the HEADERS for an object. This object can be a manifest or a layer. // This API is usually a little behind when it comes to fetching the details for an uploaded object. // This is why we put it in a retry loop and break it as soon as we get the data -func (fb *filebase) Metadata(identifier string) (*skynet.Metadata, error) { +func (fb *filebase) Metadata(identifier string) (*types.ObjectMetadata, error) { var resp *s3.HeadObjectOutput var err error @@ -248,10 +247,10 @@ func (fb *filebase) Metadata(identifier string) (*skynet.Metadata, error) { cid = identifier } - return &skynet.Metadata{ + return &types.ObjectMetadata{ ContentType: *resp.ContentType, Etag: *resp.ETag, - Skylink: cid, + DFSLink: cid, ContentLength: int(resp.ContentLength), }, nil } diff --git a/dfs/mock/storage.go b/dfs/mock/storage.go index f96cafaf..3ff04af9 100644 --- a/dfs/mock/storage.go +++ b/dfs/mock/storage.go @@ -10,11 +10,10 @@ import ( "os" "strings" - skynet "github.com/SkynetLabs/go-skynet/v2" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/containerish/OpenRegistry/config" "github.com/containerish/OpenRegistry/dfs" - "github.com/containerish/OpenRegistry/types" + types "github.com/containerish/OpenRegistry/store/v2/types" "github.com/fatih/color" "github.com/google/uuid" "github.com/labstack/echo/v4" @@ -126,7 +125,7 @@ func (ms *mockStorage) Download(ctx context.Context, path string) (io.ReadCloser return fd, nil } -func (ms *mockStorage) DownloadDir(skynetLink, dir string) error { +func (ms *mockStorage) DownloadDir(dfsLink, dir string) error { return nil } @@ -138,7 +137,7 @@ func (ms *mockStorage) AddImage(ns string, mf, l map[string][]byte) (string, err return "", nil } -func (ms *mockStorage) Metadata(identifier string) (*skynet.Metadata, error) { +func (ms *mockStorage) Metadata(identifier string) (*types.ObjectMetadata, error) { var ( fd afero.File err error @@ -160,10 +159,10 @@ func (ms *mockStorage) Metadata(identifier string) (*skynet.Metadata, error) { } fd.Close() - return &skynet.Metadata{ + return &types.ObjectMetadata{ ContentType: "", Etag: "", - Skylink: identifier, + DFSLink: identifier, ContentLength: int(stat.Size()), }, nil diff --git a/dfs/storj/storj.go b/dfs/storj/storj.go index 4ea2bcbd..b08cc521 100644 --- a/dfs/storj/storj.go +++ b/dfs/storj/storj.go @@ -7,13 +7,12 @@ import ( "io" "time" - "github.com/SkynetLabs/go-skynet/v2" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/containerish/OpenRegistry/config" "github.com/containerish/OpenRegistry/dfs" - "github.com/containerish/OpenRegistry/types" + "github.com/containerish/OpenRegistry/store/v2/types" "github.com/opencontainers/go-digest" ) @@ -185,7 +184,7 @@ func (sj *storj) Download(ctx context.Context, path string) (io.ReadCloser, erro return resp.Body, nil } -func (sj *storj) DownloadDir(skynetLink, dir string) error { +func (sj *storj) DownloadDir(dfsLink, dir string) error { return nil } @@ -200,7 +199,7 @@ func (sj *storj) AddImage(ns string, mf, l map[string][]byte) (string, error) { // Metadata API returns the HEADERS for an object. This object can be a manifest or a layer. // This API is usually a little behind when it comes to fetching the details for an uploaded object. // This is why we put it in a retry loop and break it as soon as we get the data -func (sj *storj) Metadata(identifier string) (*skynet.Metadata, error) { +func (sj *storj) Metadata(identifier string) (*types.ObjectMetadata, error) { var resp *s3.HeadObjectOutput var err error @@ -222,10 +221,10 @@ func (sj *storj) Metadata(identifier string) (*skynet.Metadata, error) { return nil, fmt.Errorf("ERR_STORJ_METADATA_HEAD: %w", err) } - return &skynet.Metadata{ + return &types.ObjectMetadata{ ContentType: *resp.ContentType, Etag: *resp.ETag, - Skylink: identifier, + DFSLink: identifier, ContentLength: int(resp.ContentLength), }, nil } diff --git a/dfs/storj/uplink/uplink.go b/dfs/storj/uplink/uplink.go index 393838aa..e5efec38 100644 --- a/dfs/storj/uplink/uplink.go +++ b/dfs/storj/uplink/uplink.go @@ -7,11 +7,10 @@ import ( "log" "time" - "github.com/SkynetLabs/go-skynet/v2" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/containerish/OpenRegistry/config" "github.com/containerish/OpenRegistry/dfs" - "github.com/containerish/OpenRegistry/types" + "github.com/containerish/OpenRegistry/store/v2/types" "github.com/fatih/color" "storj.io/uplink" "storj.io/uplink/edge" @@ -170,14 +169,14 @@ func (u *storjUplink) GetUploadProgress(identifier string, uploadID string) (*ty } // Metadata implements dfs.DFS -func (u *storjUplink) Metadata(dfsLink string) (*skynet.Metadata, error) { +func (u *storjUplink) Metadata(dfsLink string) (*types.ObjectMetadata, error) { metadata, err := u.client.StatObject(context.Background(), u.bucket, dfsLink) if err != nil { return nil, err } - return &skynet.Metadata{ - Skylink: metadata.Key, + return &types.ObjectMetadata{ + DFSLink: metadata.Key, ContentLength: int(metadata.System.ContentLength), }, nil } @@ -252,7 +251,7 @@ func (u *storjUplink) List(path string) ([]*types.Metadata, error) { } // DownloadDir implements dfs.DFS -func (u *storjUplink) DownloadDir(skynetLink string, dir string) error { +func (u *storjUplink) DownloadDir(dfsLink string, dir string) error { panic("unimplemented") } diff --git a/docs/contributing/development-environment-setup.md b/docs/contributing/development-environment-setup.md index bd4657bd..56dfe460 100644 --- a/docs/contributing/development-environment-setup.md +++ b/docs/contributing/development-environment-setup.md @@ -34,7 +34,6 @@ registry: services: - github - token - - skynet_homescreen dfs: s3_any: access_key: diff --git a/env-vars.example b/env-vars.example index bf958746..5f3e92ab 100644 --- a/env-vars.example +++ b/env-vars.example @@ -3,14 +3,12 @@ OPEN_REGISTRY_DOMAIN=beta.openregistry.dev OPEN_REGISTRY_VERSION="master" OPEN_REGISTRY_HOST=0.0.0.0 OPEN_REGISTRY_PORT=5000 -OPEN_REGISTRY_SKYNET_PORTAL_URL=https://siasky.net OPEN_REGISTRY_SIGNING_SECRET="" OPEN_REGISTRY_SUPPORTED_SERVICES=github,token OPEN_REGISTRY_ENVIRONMENT=local OPEN_REGISTRY_LOG_SERVICE_NAME=grafana-loki OPEN_REGISTRY_LOG_SERVICE_HOST=http://0.0.0.0:9880/app.log OPEN_REGISTRY_LOG_SERVICE_AUTH_KIND=basic -OPEN_REGISTRY_SKYNET_API_KEY="" OPEN_REGISTRY_DB_HOST=0.0.0.0 OPEN_REGISTRY_DB_PORT=5432 OPEN_REGISTRY_DB_USER=postgres diff --git a/go.mod b/go.mod index 244c7771..5333c4a0 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,8 @@ module github.com/containerish/OpenRegistry -go 1.19 +go 1.21 require ( - github.com/SkynetLabs/go-skynet/v2 v2.0.2 github.com/alexliesenfeld/health v0.8.0 github.com/aws/aws-sdk-go-v2 v1.21.2 github.com/aws/aws-sdk-go-v2/config v1.19.0 @@ -56,6 +55,7 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/mattn/go-sqlite3 v1.14.17 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -64,8 +64,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/tools v0.13.0 // indirect @@ -150,7 +149,6 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/zeebo/blake3 v0.2.3 // indirect github.com/zeebo/errs v1.3.0 // indirect - gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8 // indirect golang.org/x/net v0.17.0 golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.13.0 // indirect @@ -163,5 +161,3 @@ require ( storj.io/common v0.0.0-20230920095429-0ce0a575e6f8 // indirect storj.io/drpc v0.0.33 // indirect ) - -replace github.com/SkynetLabs/go-skynet/v2 => github.com/containerish/go-skynet/v2 v2.0.2-0.20220629062209-f31ff192458d diff --git a/go.sum b/go.sum index 1182c1a0..e887ab46 100644 --- a/go.sum +++ b/go.sum @@ -103,8 +103,6 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/containerish/go-skynet/v2 v2.0.2-0.20220629062209-f31ff192458d h1:FJN3IBHTidtf0RgzkUpqESXY9Q7IomATzYgKlwMpYw0= -github.com/containerish/go-skynet/v2 v2.0.2-0.20220629062209-f31ff192458d/go.mod h1:XOk0zwGlXeGjHQgmhXTEk7qTD6FVv3dXPW38Wh3XsIc= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -114,7 +112,9 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dsnet/try v0.0.3 h1:ptR59SsrcFUYbT/FhAbKTV6iLkeD6O18qfIWRml2fqI= +github.com/dsnet/try v0.0.3/go.mod h1:WBM8tRpUmnXXhY1U6/S8dt6UWdHTQ7y8A5YSkRCkq40= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -128,6 +128,7 @@ github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBD github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= @@ -140,6 +141,7 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= @@ -148,6 +150,7 @@ github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7N github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-webauthn/webauthn v0.8.6 h1:bKMtL1qzd2WTFkf1mFTVbreYrwn7dsYmEPjTq6QN90E= github.com/go-webauthn/webauthn v0.8.6/go.mod h1:emwVLMCI5yx9evTTvr0r+aOZCdWJqMfbRhF0MufyUog= github.com/go-webauthn/x v0.1.4 h1:sGmIFhcY70l6k7JIDfnjVBiAAFEssga5lXIUXe0GtAs= @@ -175,6 +178,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -232,6 +236,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= @@ -239,7 +244,6 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= @@ -327,10 +331,12 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo-contrib v0.15.0 h1:9K+oRU265y4Mu9zpRDv3X+DGTqUALY6oRHCSZZKCRVU= github.com/labstack/echo-contrib v0.15.0/go.mod h1:lei+qt5CLB4oa7VHTE0yEfQSEB9XTJI1LUqko9UWvo4= github.com/labstack/echo-jwt/v4 v4.2.0 h1:odSISV9JgcSCuhgQSV/6Io3i7nUmfM/QkBeR5GVJj5c= @@ -371,8 +377,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= github.com/opencontainers/distribution-spec v1.0.1 h1:hT6tF6uKZAQh+HH3BrJqn7/xHhMoDHzahIg4KxD2DqM= github.com/opencontainers/distribution-spec v1.0.1/go.mod h1:copR2flp+jTEvQIFMb6MIx45OkrxzqyjszPDT3hx/5Q= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -385,6 +391,7 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -395,11 +402,14 @@ github.com/prometheus/common v0.40.0/go.mod h1:L65ZJPSmfn/UBWLQIHV7dBrKFidB/wPlF github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/quic-go/qtls-go1-20 v0.3.2 h1:rRgN3WfnKbyik4dBV8A6girlJVxGand/d+jVKbQq5GI= +github.com/quic-go/qtls-go1-20 v0.3.2/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= github.com/quic-go/quic-go v0.38.0 h1:T45lASr5q/TrVwt+jrVccmqHhPL2XuSyoCLVCpfOSLc= +github.com/quic-go/quic-go v0.38.0/go.mod h1:MPCuRq7KBK2hNcfKj/1iD1BGuN3eAYMeNxp3T42LRUg= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= @@ -500,8 +510,6 @@ github.com/zeebo/errs v1.3.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtC github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8 h1:gZfMjx7Jr6N8b7iJO4eUjDsn6xJqoyXg8D+ogdoAfKY= -gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -512,13 +520,11 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -878,7 +884,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -906,7 +911,9 @@ modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y= modernc.org/ccgo/v3 v3.16.15 h1:KbDR3ZAVU+wiLyMESPtbtE/Add4elztFyfsWoNTgxS0= modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI= modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= +modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= +modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= @@ -920,9 +927,11 @@ modernc.org/sqlite v1.25.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= +modernc.org/tcl v1.15.2/go.mod h1:3+k/ZaEbKrC8ePv8zJWPtBSW0V7Gg9g8rkmhI1Kfs3c= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY= +modernc.org/z v1.7.3/go.mod h1:Ipv4tsdxZRbQyLq9Q1M6gdbkxYzdlrciF2Hi/lS7nWE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/scripts/postgres/OpenRegistry.sql b/scripts/postgres/OpenRegistry.sql index 5b9027d0..b92f85d4 100644 --- a/scripts/postgres/OpenRegistry.sql +++ b/scripts/postgres/OpenRegistry.sql @@ -15,7 +15,7 @@ CREATE TABLE "config" ( "namespace" text NOT NULL, "reference" text NOT NULL, "digest" text NOT NULL, - "sky_link" text, + "dfs_link" text, "media_type" text, "layers" text[], "size" int, @@ -25,7 +25,7 @@ CREATE TABLE "config" ( CREATE TABLE "blob" ( "uuid" uuid, "digest" text PRIMARY KEY, - "sky_link" text, + "dfs_link" text, "start_range" int, "end_range" int ); @@ -35,7 +35,7 @@ CREATE TABLE "layer" ( "digest" text UNIQUE NOT NULL, "blob_ids" text[], "media_type" text, - "sky_link" text, + "dfs_link" text, "size" int ); diff --git a/store/postgres/container_image.go b/store/postgres/container_image.go index 7c074eb7..1af685be 100644 --- a/store/postgres/container_image.go +++ b/store/postgres/container_image.go @@ -152,7 +152,7 @@ func (p *pg) GetBlob(ctx context.Context, digest string) ([]*types.Blob, error) if err := rows.Scan( &blob.UUID, &blob.Digest, - &blob.Skylink, + &blob.DFSLink, &blob.RangeStart, &blob.RangeEnd, &blob.CreatedAt, @@ -170,7 +170,7 @@ func (p *pg) SetBlob(ctx context.Context, txn pgx.Tx, b *types.Blob) error { childCtx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() - _, err := txn.Exec(childCtx, queries.SetBlob, b.UUID, b.Digest, b.Skylink, b.RangeStart, b.RangeEnd, b.CreatedAt) + _, err := txn.Exec(childCtx, queries.SetBlob, b.UUID, b.Digest, b.DFSLink, b.RangeStart, b.RangeEnd, b.CreatedAt) return err diff --git a/store/postgres/queries/registry.go b/store/postgres/queries/registry.go index a8d61ac4..75428d8f 100644 --- a/store/postgres/queries/registry.go +++ b/store/postgres/queries/registry.go @@ -5,16 +5,16 @@ package queries var ( SetImageManifest = `insert into image_manifest (uuid, namespace, media_type, schema_version, created_at, updated_at) values ($1, $2, $3, $4, $5, $6) on conflict (namespace) do update set updated_at=$6` - SetLayer = `insert into layer (media_type, digest, sky_link, uuid, blob_ids, size,created_at,updated_at) + SetLayer = `insert into layer (media_type, digest, dfs_link, uuid, blob_ids, size,created_at,updated_at) values ($1, $2, $3, $4, $5, $6,$7,$8) on conflict (digest) do update set updated_at=$8;` // SetBlob TODO - (guacamole/jay-dee7) find a better way to handle duplicates in blob - SetBlob = `insert into blob (uuid, digest, sky_link, start_range, end_range, created_at) + SetBlob = `insert into blob (uuid, digest, dfs_link, start_range, end_range, created_at) values ($1, $2, $3, $4, $5, $6) on conflict (digest) do nothing;` - SetConfig = `insert into config (uuid, namespace, reference, digest, sky_link, media_type, layers, size, + SetConfig = `insert into config (uuid, namespace, reference, digest, dfs_link, media_type, layers, size, created_at, updated_at) values ($1, $2, $3, $4, $5, $6,$7, $8, $9, $10) on conflict (namespace,reference) - do update set digest=$4, sky_link=$5,layers=$7,updated_at=$10;` + do update set digest=$4, dfs_link=$5,layers=$7,updated_at=$10;` ) // select queries @@ -22,7 +22,7 @@ var ( GetDigest = `select digest from layers where digest=$1;` ReadMetadata = `select * from metadata where namespace=$1;` GetLayer = `select * from layer where digest=$1;` - GetContentHashById = `select sky_link from layer where uuid=$1;` + GetContentHashById = `select dfs_link from layer where uuid=$1;` GetManifest = `select * from image_manifest where namespace=$1;` GetBlob = `select * from blob where digest=$1;` GetConfig = `select * from config where namespace=$1;` @@ -42,7 +42,7 @@ var ( image_manifest order by %s limit $1 offset $2;` GetUserCatalogDetailWithPagination = `select namespace,created_at::timestamptz,updated_at::timestamptz from image_manifest where namespace like $1 order by %s limit $2 offset $3;` - GetRepoDetailWithPagination = `select reference, digest, sky_link, (select sum(size) from layer where digest = + GetRepoDetailWithPagination = `select reference, digest, dfs_link, (select sum(size) from layer where digest = ANY(layers)) as size, created_at::timestamptz, updated_at::timestamptz from config where namespace=$1 limit $2 offset $3;` UpdateContainerImageVisibility = `update image_manifest set visibility=$1 where uuid=$2` diff --git a/store/v2/types/storage.go b/store/v2/types/storage.go new file mode 100644 index 00000000..ca35d4e5 --- /dev/null +++ b/store/v2/types/storage.go @@ -0,0 +1,15 @@ +package types + +type ( + Metadata struct { + Namespace string + Manifest ImageManifest + } + + ObjectMetadata struct { + ContentType string + Etag string + DFSLink string + ContentLength int + } +) diff --git a/types/types.go b/types/types.go index ff9561b9..ace1984b 100644 --- a/types/types.go +++ b/types/types.go @@ -38,19 +38,19 @@ type ( Blob struct { CreatedAt time.Time Digest string - Skylink string + DFSLink string UUID string RangeStart uint32 RangeEnd uint32 } Layer struct { - MediaType string `json:"mediaType"` - Digest string `json:"digest"` - SkynetLink string `json:"skynetLink"` - UUID string `json:"uuid"` - Blobs []Blob `json:"blobs"` - Size int `json:"size"` + MediaType string `json:"mediaType"` + Digest string `json:"digest"` + DFSLink string `json:"dfsLink"` + UUID string `json:"uuid"` + Blobs []Blob `json:"blobs"` + Size int `json:"size"` } LayerV2 struct { @@ -58,7 +58,7 @@ type ( UpdatedAt time.Time `json:"updated_at,omitempty"` MediaType string `json:"mediaType"` Digest string `json:"digest"` - DFSLink string `json:"skynetLink"` + DFSLink string `json:"dfsLink"` UUID string `json:"uuid"` BlobDigests []string `json:"blobs"` Size int `json:"size"` @@ -66,15 +66,15 @@ type ( LayerRef struct { Digest string - Skylink string + DFSLink string } Config struct { - MediaType string `json:"mediaType"` - Digest string `json:"digest"` - SkynetLink string `json:"skynetLink"` - Reference string `json:"reference"` - Size int `json:"size"` + MediaType string `json:"mediaType"` + Digest string `json:"digest"` + DFSLink string `json:"dfsLink"` + Reference string `json:"reference"` + Size int `json:"size"` } ConfigV2 struct { @@ -82,7 +82,7 @@ type ( UpdatedAt time.Time `json:"updated_at"` UUID string `json:"uuid,omitempty"` Namespace string `json:"namespace,omitempty"` - DFSLink string `json:"sky_link,omitempty"` + DFSLink string `json:"dfs_link,omitempty"` MediaType string `json:"media_type,omitempty"` Reference string `json:"reference"` Digest string `json:"digest"` @@ -156,13 +156,13 @@ func (md Metadata) FindLayer(ref string) *Layer { func (md Metadata) FindLinkForDigest(ref string) (string, error) { for _, c := range md.Manifest.Config { if c.Digest == ref || c.Reference == ref { - return c.SkynetLink, nil + return c.DFSLink, nil } } for _, l := range md.Manifest.Layers { if l.Digest == ref { - return l.SkynetLink, nil + return l.DFSLink, nil } }