Documentation ¶
Overview ¶
Copyright (C) 2020 Synopsys, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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 (C) 2020 Synopsys, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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 (C) 2020 Synopsys, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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 (C) 2020 Synopsys, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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 ¶
- func CommandAddEnvironment(cmd *exec.Cmd, env map[string]string)
- func CommandRunAndPrint(cmd *exec.Cmd) error
- func CommandSetDirectory(cmd *exec.Cmd, directory string)
- func CopyFromGSBucket(bucketName, serviceAccountPath, bucketFilePath, localFilePath string) error
- func CopyToGSBucket(bucketName, serviceAccountPath, bucketFilePath, localFilePath string) error
- func CreateIfNotExists(path string) error
- func DownloadFile(filepath string, url string) (err error)
- func FileExists(path string) (bool, error)
- func Unzip(source string, destination string) ([]string, error)
- func Zipit(source, target string) error
- type PriorityQueue
- func (pq *PriorityQueue) Add(key string, priority int, value interface{}) error
- func (pq *PriorityQueue) CheckValidity() []string
- func (pq *PriorityQueue) DebugString() string
- func (pq *PriorityQueue) Dump() []map[string]interface{}
- func (pq *PriorityQueue) HasKey(key string) bool
- func (pq *PriorityQueue) IsEmpty() bool
- func (pq *PriorityQueue) Peek() interface{}
- func (pq *PriorityQueue) Pop() (string, interface{}, error)
- func (pq *PriorityQueue) Remove(key string) (interface{}, error)
- func (pq *PriorityQueue) Set(key string, priority int) error
- func (pq *PriorityQueue) Size() int
- func (pq *PriorityQueue) Values() []interface{}
- type Timer
- type TimerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandRunAndPrint ¶
func CommandSetDirectory ¶
func CopyFromGSBucket ¶
func CopyToGSBucket ¶
func CreateIfNotExists ¶
func DownloadFile ¶
func FileExists ¶
FileExists returns whether the given file or directory exists
func Unzip ¶
This code is from https://golangcode.com/unzip-files-in-go/ and https://stackoverflow.com/a/24792688/894284
Types ¶
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue uses a max heap, and provides efficient changing of priority.
func (*PriorityQueue) Add ¶
func (pq *PriorityQueue) Add(key string, priority int, value interface{}) error
Add adds an element. 'key' must be unique.
func (*PriorityQueue) CheckValidity ¶
func (pq *PriorityQueue) CheckValidity() []string
CheckValidity should always return an empty slice -- it is just a debugging tool. If it returns a non-empty slice, then there's a bug somewhere in the heap code.
func (*PriorityQueue) DebugString ¶
func (pq *PriorityQueue) DebugString() string
DebugString should only be used for debugging.
func (*PriorityQueue) Dump ¶
func (pq *PriorityQueue) Dump() []map[string]interface{}
Dump should only be used for debugging.
func (*PriorityQueue) HasKey ¶
func (pq *PriorityQueue) HasKey(key string) bool
HasKey returns whether the priority queue has the key.
func (*PriorityQueue) Peek ¶
func (pq *PriorityQueue) Peek() interface{}
Peek returns the highest priority item, or nil if empty.
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() (string, interface{}, error)
Pop removes the highest priority element, returning an error if empty.
func (*PriorityQueue) Remove ¶
func (pq *PriorityQueue) Remove(key string) (interface{}, error)
Remove removes the value associated with the key from the priority queue, returning an error if it can't be found.
func (*PriorityQueue) Set ¶
func (pq *PriorityQueue) Set(key string, priority int) error
Set changes the priority of 'value' if it can be found, and returns an error if not.
func (*PriorityQueue) Size ¶
func (pq *PriorityQueue) Size() int
Size returns the number of elements in the queue.
func (*PriorityQueue) Values ¶
func (pq *PriorityQueue) Values() []interface{}
Values should only be used for debugging.
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer periodically executes `action`, waiting `delay` between invocation starts. If `action` takes longer than `delay`, invocations will be dropped. It stops when receiving an event on `stop`. It's basically a time.Ticker with additional functionality for pausing and resuming.
func NewRunningTimer ¶
func NewRunningTimer(name string, delay time.Duration, stop <-chan struct{}, runImmediately bool, action func()) *Timer
NewRunningTimer creates a new timer which is running
func (*Timer) Pause ¶
Pause temporarily stops the timer. It returns an error if the timer could not be paused.
type TimerState ¶
type TimerState int
TimerState describes the state of a timer
const ( TimerStateReady TimerState = iota TimerStateRunningAction TimerState = iota TimerStatePaused TimerState = iota TimerStateStopped TimerState = iota )
.....