Documentation ¶
Overview ¶
* Copyright The Dragonfly 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.
* Copyright The Dragonfly 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.
* Copyright The Dragonfly 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.
* Copyright The Dragonfly 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.
* Copyright The Dragonfly 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.
* Copyright The Dragonfly 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.
* Copyright The Dragonfly 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.
Index ¶
- Constants
- Variables
- func NewManager(cfg *config.Config) (mgr.PreheatManager, error)
- func RegisterPreheater(typ string, preheater Preheater)
- type BasePreheater
- type BaseWorker
- type FilePreheat
- type FileWorker
- type IWorker
- type ImagePreheat
- type ImageWorker
- type Layer
- type Manager
- func (m *Manager) Create(ctx context.Context, task *types.PreheatCreateRequest) (preheatID string, err error)
- func (m *Manager) Delete(ctx context.Context, preheatID string) (err error)
- func (m *Manager) Get(ctx context.Context, preheatID string) (preheatTask *mgr.PreheatTask, err error)
- func (m *Manager) GetAll(ctx context.Context) (preheatTasks []*mgr.PreheatTask, err error)
- type PreheatProgress
- type PreheatService
- func (svc *PreheatService) Create(task *mgr.PreheatTask) (string, error)
- func (svc *PreheatService) Delete(id string)
- func (svc *PreheatService) ExecutePreheat(task *mgr.PreheatTask) (progress *PreheatProgress, err error)
- func (svc *PreheatService) Get(id string) *mgr.PreheatTask
- func (svc *PreheatService) GetAll() []*mgr.PreheatTask
- func (svc *PreheatService) Update(id string, task *mgr.PreheatTask) bool
- type PreheatTaskRepository
- func (r *PreheatTaskRepository) Add(task *mgr.PreheatTask) (*mgr.PreheatTask, error)
- func (r *PreheatTaskRepository) Delete(id string) bool
- func (r *PreheatTaskRepository) Get(id string) *mgr.PreheatTask
- func (r *PreheatTaskRepository) GetAll() []*mgr.PreheatTask
- func (r *PreheatTaskRepository) GetAllIds() []string
- func (r *PreheatTaskRepository) IsExpired(id string) bool
- func (r *PreheatTaskRepository) Update(id string, task *mgr.PreheatTask) bool
- type Preheater
Constants ¶
const (
// preheat image cache one week
EXPIRED_TIME = 7 * 24 * 3600 * 1000
)
const TIMEOUT = 30 * 60
Variables ¶
var IMAGE_MANIFESTS_PATTERN, _ = regexp.Compile("^(.*)://(.*)/v2/(.*)/manifests/(.*)")
Functions ¶
func NewManager ¶
func NewManager(cfg *config.Config) (mgr.PreheatManager, error)
func RegisterPreheater ¶
Types ¶
type BasePreheater ¶
type BasePreheater struct{}
func (*BasePreheater) NewWorker ¶
func (p *BasePreheater) NewWorker(task *mgr.PreheatTask, service *PreheatService) IWorker
*
- Create a worker to preheat the task.
func (*BasePreheater) Remove ¶
func (p *BasePreheater) Remove(id string)
*
- remove a running preheat task
type BaseWorker ¶
type BaseWorker struct { Task *mgr.PreheatTask Preheater Preheater PreheatService *PreheatService // contains filtered or unexported fields }
func (*BaseWorker) Run ¶
func (w *BaseWorker) Run()
func (*BaseWorker) Stop ¶
func (w *BaseWorker) Stop()
type FilePreheat ¶
type FilePreheat struct {
*BasePreheater
}
func (*FilePreheat) NewWorker ¶
func (p *FilePreheat) NewWorker(task *mgr.PreheatTask, service *PreheatService) IWorker
*
- Create a worker to preheat the task.
func (*FilePreheat) Type ¶
func (p *FilePreheat) Type() string
type FileWorker ¶
type FileWorker struct { *BaseWorker // contains filtered or unexported fields }
type ImagePreheat ¶
type ImagePreheat struct {
*BasePreheater
}
func (*ImagePreheat) NewWorker ¶
func (p *ImagePreheat) NewWorker(task *mgr.PreheatTask, service *PreheatService) IWorker
*
- Create a worker to preheat the task.
func (*ImagePreheat) Type ¶
func (p *ImagePreheat) Type() string
type ImageWorker ¶
type ImageWorker struct { *BaseWorker // contains filtered or unexported fields }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an implementation of interface PreheatManager.
type PreheatProgress ¶
type PreheatProgress struct {
// contains filtered or unexported fields
}
func NewPreheatProgress ¶
func NewPreheatProgress(output string, cmd *exec.Cmd) *PreheatProgress
type PreheatService ¶
type PreheatService struct { PreheatPath string // contains filtered or unexported fields }
func NewPreheatService ¶
func NewPreheatService(homeDir string) *PreheatService
func (*PreheatService) Create ¶
func (svc *PreheatService) Create(task *mgr.PreheatTask) (string, error)
create a preheat task
func (*PreheatService) ExecutePreheat ¶
func (svc *PreheatService) ExecutePreheat(task *mgr.PreheatTask) (progress *PreheatProgress, err error)
execute preheat task
func (*PreheatService) Get ¶
func (svc *PreheatService) Get(id string) *mgr.PreheatTask
Get detailed preheat task information
func (*PreheatService) GetAll ¶
func (svc *PreheatService) GetAll() []*mgr.PreheatTask
Get all preheat tasks
func (*PreheatService) Update ¶
func (svc *PreheatService) Update(id string, task *mgr.PreheatTask) bool
update a preheat task
type PreheatTaskRepository ¶
type PreheatTaskRepository struct {
// contains filtered or unexported fields
}
func NewPreheatTaskRepository ¶
func NewPreheatTaskRepository() *PreheatTaskRepository
func (*PreheatTaskRepository) Add ¶
func (r *PreheatTaskRepository) Add(task *mgr.PreheatTask) (*mgr.PreheatTask, error)
func (*PreheatTaskRepository) Delete ¶
func (r *PreheatTaskRepository) Delete(id string) bool
func (*PreheatTaskRepository) Get ¶
func (r *PreheatTaskRepository) Get(id string) *mgr.PreheatTask
func (*PreheatTaskRepository) GetAll ¶
func (r *PreheatTaskRepository) GetAll() []*mgr.PreheatTask
func (*PreheatTaskRepository) GetAllIds ¶
func (r *PreheatTaskRepository) GetAllIds() []string
func (*PreheatTaskRepository) IsExpired ¶
func (r *PreheatTaskRepository) IsExpired(id string) bool
func (*PreheatTaskRepository) Update ¶
func (r *PreheatTaskRepository) Update(id string, task *mgr.PreheatTask) bool
type Preheater ¶
type Preheater interface { /** * The type of this preheater */ Type() string /** * Create a worker to preheat the task. */ NewWorker(task *mgr.PreheatTask, service *PreheatService) IWorker /** * cancel the running task */ Cancel(id string) /** * remove a running preheat task */ Remove(id string) }