-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support multiple user-facing network interfaces (multi-homing)
* part three Signed-off-by: Alex Aizman <[email protected]>
- Loading branch information
1 parent
3ecd430
commit 539e819
Showing
9 changed files
with
120 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Package cos provides common low-level types and utilities for all aistore projects. | ||
/* | ||
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved. | ||
*/ | ||
package cos | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/NVIDIA/aistore/cmn/nlog" | ||
) | ||
|
||
const fatalPrefix = "FATAL ERROR: " | ||
|
||
func _exit(msg string) { | ||
fmt.Fprintln(os.Stderr, msg) | ||
os.Exit(1) | ||
} | ||
|
||
func Exitf(f string, a ...any) { | ||
msg := fmt.Sprintf(fatalPrefix+f, a...) | ||
_exit(msg) | ||
} | ||
|
||
// +log | ||
func ExitLogf(f string, a ...any) { | ||
msg := fmt.Sprintf(fatalPrefix+f, a...) | ||
if flag.Parsed() { | ||
nlog.ErrorDepth(1, msg+"\n") | ||
nlog.Flush(nlog.ActExit) | ||
} | ||
_exit(msg) | ||
} | ||
|
||
func ExitLog(a ...any) { | ||
msg := fatalPrefix + fmt.Sprint(a...) | ||
if flag.Parsed() { | ||
nlog.ErrorDepth(1, msg+"\n") | ||
nlog.Flush(nlog.ActExit) | ||
} | ||
_exit(msg) | ||
} | ||
|
||
// +condition | ||
func ExitAssertLog(cond bool, a ...any) { | ||
if !cond { | ||
ExitLog(a...) | ||
} | ||
} |