util

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2021 IBM Corporation

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.

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 CalcMemCapacity added in v0.9.0

func CalcMemCapacity(reqModelKey string, defaultSize int, multiplier float64, log logr.Logger) uint64

func ClearDirectoryContents added in v0.10.0

func ClearDirectoryContents(dirPath string, condition func(entry os.DirEntry) bool) error

ClearDirectoryContents Clear contents of directory if it exists. If condition is specified then only delete dir entries to which it returns true

func FileExists

func FileExists(path string) (bool, error)

Check if a file exists at path

func GetModelType added in v0.8.0

func GetModelType(req *mmesh.LoadModelRequest, log logr.Logger) string

GetModelType first tries to read the type from the LoadModelRequest.ModelKey json If there is an error parsing LoadModelRequest.ModelKey or the type is not found there, this will return the LoadModelRequest.ModelType which could possibly be an empty string

func GetSchemaPath added in v0.8.0

func GetSchemaPath(req *mmesh.LoadModelRequest) (string, error)

GetSchemaPath extracts the schema path from the ModelKey field Will return an error if schema path exists but is in an invalid format

func RemoveFileFromListOfFileInfo

func RemoveFileFromListOfFileInfo(filename string, files []os.DirEntry) (bool, []os.DirEntry)

RemoveFileFromListOfFileInfo The input `files` content is modified, the order of elements is changed

func ResolveLocalGrpcEndpoint added in v0.10.0

func ResolveLocalGrpcEndpoint(servingRuntimeEndpoint string) (string, error)

func SecureJoin

func SecureJoin(elem ...string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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