pkg

package
v0.0.0-...-0967915 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2020 Security Scorecard Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Bucket *blob.Bucket
}

Cache that use the blob storage like GCS or S3.

func NewBucket

func NewBucket(bucketKey string) (*Cache, error)

NewBucket opens the bucket for caching.

func (*Cache) Delete

func (c *Cache) Delete(key string) error

Delete removes key from the cache.

func (*Cache) Get

func (c *Cache) Get(key string) ([]byte, bool)

Get returns the []byte representation of the response and true if present, false if not.The error is not returned to maintain compatabiltiy with the httpcache Cache interface.

func (*Cache) Set

func (c *Cache) Set(key string, resp []byte) error

Set saves response resp to the cache with key. The error is not returned to maintain compatabiltiy with the httpcache Cache interface.

type CacheService

type CacheService interface {
	// UpdateCache updates the git cache into the gocloud.dev blob storage.
	UpdateCache(string) error
}

CacheService updates git cache.

func NewCacheService

func NewCacheService(blobURL, tempDir string, logf func(s string, f ...interface{})) (CacheService, error)

NewCacheService returns new CacheService.

type RepoURL

type RepoURL struct {
	Host  string // Host where the repo is stored. Example GitHub.com
	Owner string // Owner of the repo. Example ossf.
	Repo  string // The actual repo. Example scorecard.
}

TODO: This is an exact replica of repos.RepoURL. Combine them somehow. RepoURL parses and stores URL into fields.

func (*RepoURL) NonURLString

func (r *RepoURL) NonURLString() string

func (*RepoURL) Set

func (r *RepoURL) Set(s string) error

func (*RepoURL) String

func (r *RepoURL) String() string

type StoragePath

type StoragePath struct {
	BucketPath         string // name of the bucket that is going store the content
	GitDir             string // directory in which the git folder would be used for pull/clone
	GitTarDir          string // directory for tar/gzip the git folder
	GitTarFile         string // the tar file name for the git folder
	BlobArchiveDir     string // directory which is going archive the git folder without .git
	BlobArchiveFile    string // the tar file for the git folder without  .git
	BlobLastCommitPath string // blob path for storing the last commit
	BlobLastSyncPath   string // blob path for storing the lasy sync time
	BlobGitFolderPath  string // blob path for storing the GitTarFile
	BlobArchivePath    string // blob path for storing the archive file BlobArchiveFile
}

func NewStoragePath

func NewStoragePath(repo RepoURL, tempDir string) (StoragePath, error)

NewStoragePath returns path for blob, archiving and also creates temp directories for archiving.

func (*StoragePath) Cleanup

func (s *StoragePath) Cleanup()

Cleanup removes the directories that were created.

Jump to

Keyboard shortcuts

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