util

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2016 The Rook Authors. All rights reserved.

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 2017 The Rook Authors. All rights reserved.

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 2016 The Rook Authors. All rights reserved.

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

func Retry added in v0.7.0

func Retry(maxRetries int, delay time.Duration, f func() error) error

Retry will attempt the given function until it succeeds, up to the given maximum amount of retries, sleeping for the given duration in between attempts.

func WriteFile

func WriteFile(filePath string, contentBuffer bytes.Buffer) error

func WriteFileToLog added in v0.3.0

func WriteFileToLog(logger *capnslog.PackageLogger, path string)

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

func CreateSet

func CreateSet(values []string) *Set

Create a new set from the array

func NewSet

func NewSet() *Set

Create a new empty set

func SetDifference

func SetDifference(left, right []string) *Set

find items in the left slice that are not in the right slice

func (*Set) Add

func (s *Set) Add(newValue string) bool

Add a value to the set. Returns true if the value was added, false if it already exists.

func (*Set) AddMultiple

func (s *Set) AddMultiple(values []string)

Add multiple items more efficiently

func (*Set) AddSet

func (s *Set) AddSet(other *Set)

Add other set items

func (*Set) Contains

func (s *Set) Contains(value string) bool

Check whether a value is already contained in the set

func (*Set) Copy

func (s *Set) Copy() *Set

Create a copy of the set

func (*Set) Count

func (s *Set) Count() int

Get the count of items in the set

func (*Set) Equals

func (s *Set) Equals(other *Set) bool

Check if two sets contain the same elements

func (*Set) Iter

func (s *Set) Iter() <-chan string

Iterate over the items in the set

func (*Set) Remove

func (s *Set) Remove(oldValue string) bool

Add a value to the set. Returns true if the value was added, false if it already exists.

func (*Set) Subtract

func (s *Set) Subtract(subset *Set)

Subtract the subset from the set

func (*Set) ToSlice

func (s *Set) ToSlice() []string

Convert the set to an array

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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