-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from arangodb/bugfix/kube-1.11-pv-fix
Fixed PV creation on kubernetes 1.11
- Loading branch information
Showing
4,933 changed files
with
707,790 additions
and
309,073 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Microsoft Corporation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,12 @@ | ||
# go-ansiterm | ||
|
||
This is a cross platform Ansi Terminal Emulation library. It reads a stream of Ansi characters and produces the appropriate function calls. The results of the function calls are platform dependent. | ||
|
||
For example the parser might receive "ESC, [, A" as a stream of three characters. This is the code for Cursor Up (http://www.vt100.net/docs/vt510-rm/CUU). The parser then calls the cursor up function (CUU()) on an event handler. The event handler determines what platform specific work must be done to cause the cursor to move up one position. | ||
|
||
The parser (parser.go) is a partial implementation of this state machine (http://vt100.net/emu/vt500_parser.png). There are also two event handler implementations, one for tests (test_event_handler.go) to validate that the expected events are being produced and called, the other is a Windows implementation (winterm/win_event_handler.go). | ||
|
||
See parser_test.go for examples exercising the state machine and generating appropriate function calls. | ||
|
||
----- | ||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. |
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,188 @@ | ||
package ansiterm | ||
|
||
const LogEnv = "DEBUG_TERMINAL" | ||
|
||
// ANSI constants | ||
// References: | ||
// -- http://www.ecma-international.org/publications/standards/Ecma-048.htm | ||
// -- http://man7.org/linux/man-pages/man4/console_codes.4.html | ||
// -- http://manpages.ubuntu.com/manpages/intrepid/man4/console_codes.4.html | ||
// -- http://en.wikipedia.org/wiki/ANSI_escape_code | ||
// -- http://vt100.net/emu/dec_ansi_parser | ||
// -- http://vt100.net/emu/vt500_parser.svg | ||
// -- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html | ||
// -- http://www.inwap.com/pdp10/ansicode.txt | ||
const ( | ||
// ECMA-48 Set Graphics Rendition | ||
// Note: | ||
// -- Constants leading with an underscore (e.g., _ANSI_xxx) are unsupported or reserved | ||
// -- Fonts could possibly be supported via SetCurrentConsoleFontEx | ||
// -- Windows does not expose the per-window cursor (i.e., caret) blink times | ||
ANSI_SGR_RESET = 0 | ||
ANSI_SGR_BOLD = 1 | ||
ANSI_SGR_DIM = 2 | ||
_ANSI_SGR_ITALIC = 3 | ||
ANSI_SGR_UNDERLINE = 4 | ||
_ANSI_SGR_BLINKSLOW = 5 | ||
_ANSI_SGR_BLINKFAST = 6 | ||
ANSI_SGR_REVERSE = 7 | ||
_ANSI_SGR_INVISIBLE = 8 | ||
_ANSI_SGR_LINETHROUGH = 9 | ||
_ANSI_SGR_FONT_00 = 10 | ||
_ANSI_SGR_FONT_01 = 11 | ||
_ANSI_SGR_FONT_02 = 12 | ||
_ANSI_SGR_FONT_03 = 13 | ||
_ANSI_SGR_FONT_04 = 14 | ||
_ANSI_SGR_FONT_05 = 15 | ||
_ANSI_SGR_FONT_06 = 16 | ||
_ANSI_SGR_FONT_07 = 17 | ||
_ANSI_SGR_FONT_08 = 18 | ||
_ANSI_SGR_FONT_09 = 19 | ||
_ANSI_SGR_FONT_10 = 20 | ||
_ANSI_SGR_DOUBLEUNDERLINE = 21 | ||
ANSI_SGR_BOLD_DIM_OFF = 22 | ||
_ANSI_SGR_ITALIC_OFF = 23 | ||
ANSI_SGR_UNDERLINE_OFF = 24 | ||
_ANSI_SGR_BLINK_OFF = 25 | ||
_ANSI_SGR_RESERVED_00 = 26 | ||
ANSI_SGR_REVERSE_OFF = 27 | ||
_ANSI_SGR_INVISIBLE_OFF = 28 | ||
_ANSI_SGR_LINETHROUGH_OFF = 29 | ||
ANSI_SGR_FOREGROUND_BLACK = 30 | ||
ANSI_SGR_FOREGROUND_RED = 31 | ||
ANSI_SGR_FOREGROUND_GREEN = 32 | ||
ANSI_SGR_FOREGROUND_YELLOW = 33 | ||
ANSI_SGR_FOREGROUND_BLUE = 34 | ||
ANSI_SGR_FOREGROUND_MAGENTA = 35 | ||
ANSI_SGR_FOREGROUND_CYAN = 36 | ||
ANSI_SGR_FOREGROUND_WHITE = 37 | ||
_ANSI_SGR_RESERVED_01 = 38 | ||
ANSI_SGR_FOREGROUND_DEFAULT = 39 | ||
ANSI_SGR_BACKGROUND_BLACK = 40 | ||
ANSI_SGR_BACKGROUND_RED = 41 | ||
ANSI_SGR_BACKGROUND_GREEN = 42 | ||
ANSI_SGR_BACKGROUND_YELLOW = 43 | ||
ANSI_SGR_BACKGROUND_BLUE = 44 | ||
ANSI_SGR_BACKGROUND_MAGENTA = 45 | ||
ANSI_SGR_BACKGROUND_CYAN = 46 | ||
ANSI_SGR_BACKGROUND_WHITE = 47 | ||
_ANSI_SGR_RESERVED_02 = 48 | ||
ANSI_SGR_BACKGROUND_DEFAULT = 49 | ||
// 50 - 65: Unsupported | ||
|
||
ANSI_MAX_CMD_LENGTH = 4096 | ||
|
||
MAX_INPUT_EVENTS = 128 | ||
DEFAULT_WIDTH = 80 | ||
DEFAULT_HEIGHT = 24 | ||
|
||
ANSI_BEL = 0x07 | ||
ANSI_BACKSPACE = 0x08 | ||
ANSI_TAB = 0x09 | ||
ANSI_LINE_FEED = 0x0A | ||
ANSI_VERTICAL_TAB = 0x0B | ||
ANSI_FORM_FEED = 0x0C | ||
ANSI_CARRIAGE_RETURN = 0x0D | ||
ANSI_ESCAPE_PRIMARY = 0x1B | ||
ANSI_ESCAPE_SECONDARY = 0x5B | ||
ANSI_OSC_STRING_ENTRY = 0x5D | ||
ANSI_COMMAND_FIRST = 0x40 | ||
ANSI_COMMAND_LAST = 0x7E | ||
DCS_ENTRY = 0x90 | ||
CSI_ENTRY = 0x9B | ||
OSC_STRING = 0x9D | ||
ANSI_PARAMETER_SEP = ";" | ||
ANSI_CMD_G0 = '(' | ||
ANSI_CMD_G1 = ')' | ||
ANSI_CMD_G2 = '*' | ||
ANSI_CMD_G3 = '+' | ||
ANSI_CMD_DECPNM = '>' | ||
ANSI_CMD_DECPAM = '=' | ||
ANSI_CMD_OSC = ']' | ||
ANSI_CMD_STR_TERM = '\\' | ||
|
||
KEY_CONTROL_PARAM_2 = ";2" | ||
KEY_CONTROL_PARAM_3 = ";3" | ||
KEY_CONTROL_PARAM_4 = ";4" | ||
KEY_CONTROL_PARAM_5 = ";5" | ||
KEY_CONTROL_PARAM_6 = ";6" | ||
KEY_CONTROL_PARAM_7 = ";7" | ||
KEY_CONTROL_PARAM_8 = ";8" | ||
KEY_ESC_CSI = "\x1B[" | ||
KEY_ESC_N = "\x1BN" | ||
KEY_ESC_O = "\x1BO" | ||
|
||
FILL_CHARACTER = ' ' | ||
) | ||
|
||
func getByteRange(start byte, end byte) []byte { | ||
bytes := make([]byte, 0, 32) | ||
for i := start; i <= end; i++ { | ||
bytes = append(bytes, byte(i)) | ||
} | ||
|
||
return bytes | ||
} | ||
|
||
var toGroundBytes = getToGroundBytes() | ||
var executors = getExecuteBytes() | ||
|
||
// SPACE 20+A0 hex Always and everywhere a blank space | ||
// Intermediate 20-2F hex !"#$%&'()*+,-./ | ||
var intermeds = getByteRange(0x20, 0x2F) | ||
|
||
// Parameters 30-3F hex 0123456789:;<=>? | ||
// CSI Parameters 30-39, 3B hex 0123456789; | ||
var csiParams = getByteRange(0x30, 0x3F) | ||
|
||
var csiCollectables = append(getByteRange(0x30, 0x39), getByteRange(0x3B, 0x3F)...) | ||
|
||
// Uppercase 40-5F hex @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ | ||
var upperCase = getByteRange(0x40, 0x5F) | ||
|
||
// Lowercase 60-7E hex `abcdefghijlkmnopqrstuvwxyz{|}~ | ||
var lowerCase = getByteRange(0x60, 0x7E) | ||
|
||
// Alphabetics 40-7E hex (all of upper and lower case) | ||
var alphabetics = append(upperCase, lowerCase...) | ||
|
||
var printables = getByteRange(0x20, 0x7F) | ||
|
||
var escapeIntermediateToGroundBytes = getByteRange(0x30, 0x7E) | ||
var escapeToGroundBytes = getEscapeToGroundBytes() | ||
|
||
// See http://www.vt100.net/emu/vt500_parser.png for description of the complex | ||
// byte ranges below | ||
|
||
func getEscapeToGroundBytes() []byte { | ||
escapeToGroundBytes := getByteRange(0x30, 0x4F) | ||
escapeToGroundBytes = append(escapeToGroundBytes, getByteRange(0x51, 0x57)...) | ||
escapeToGroundBytes = append(escapeToGroundBytes, 0x59) | ||
escapeToGroundBytes = append(escapeToGroundBytes, 0x5A) | ||
escapeToGroundBytes = append(escapeToGroundBytes, 0x5C) | ||
escapeToGroundBytes = append(escapeToGroundBytes, getByteRange(0x60, 0x7E)...) | ||
return escapeToGroundBytes | ||
} | ||
|
||
func getExecuteBytes() []byte { | ||
executeBytes := getByteRange(0x00, 0x17) | ||
executeBytes = append(executeBytes, 0x19) | ||
executeBytes = append(executeBytes, getByteRange(0x1C, 0x1F)...) | ||
return executeBytes | ||
} | ||
|
||
func getToGroundBytes() []byte { | ||
groundBytes := []byte{0x18} | ||
groundBytes = append(groundBytes, 0x1A) | ||
groundBytes = append(groundBytes, getByteRange(0x80, 0x8F)...) | ||
groundBytes = append(groundBytes, getByteRange(0x91, 0x97)...) | ||
groundBytes = append(groundBytes, 0x99) | ||
groundBytes = append(groundBytes, 0x9A) | ||
groundBytes = append(groundBytes, 0x9C) | ||
return groundBytes | ||
} | ||
|
||
// Delete 7F hex Always and everywhere ignored | ||
// C1 Control 80-9F hex 32 additional control characters | ||
// G1 Displayable A1-FE hex 94 additional displayable characters | ||
// Special A0+FF hex Same as SPACE and DELETE |
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,7 @@ | ||
package ansiterm | ||
|
||
type ansiContext struct { | ||
currentChar byte | ||
paramBuffer []byte | ||
interBuffer []byte | ||
} |
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,49 @@ | ||
package ansiterm | ||
|
||
type csiEntryState struct { | ||
baseState | ||
} | ||
|
||
func (csiState csiEntryState) Handle(b byte) (s state, e error) { | ||
logger.Infof("CsiEntry::Handle %#x", b) | ||
|
||
nextState, err := csiState.baseState.Handle(b) | ||
if nextState != nil || err != nil { | ||
return nextState, err | ||
} | ||
|
||
switch { | ||
case sliceContains(alphabetics, b): | ||
return csiState.parser.ground, nil | ||
case sliceContains(csiCollectables, b): | ||
return csiState.parser.csiParam, nil | ||
case sliceContains(executors, b): | ||
return csiState, csiState.parser.execute() | ||
} | ||
|
||
return csiState, nil | ||
} | ||
|
||
func (csiState csiEntryState) Transition(s state) error { | ||
logger.Infof("CsiEntry::Transition %s --> %s", csiState.Name(), s.Name()) | ||
csiState.baseState.Transition(s) | ||
|
||
switch s { | ||
case csiState.parser.ground: | ||
return csiState.parser.csiDispatch() | ||
case csiState.parser.csiParam: | ||
switch { | ||
case sliceContains(csiParams, csiState.parser.context.currentChar): | ||
csiState.parser.collectParam() | ||
case sliceContains(intermeds, csiState.parser.context.currentChar): | ||
csiState.parser.collectInter() | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (csiState csiEntryState) Enter() error { | ||
csiState.parser.clear() | ||
return nil | ||
} |
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,38 @@ | ||
package ansiterm | ||
|
||
type csiParamState struct { | ||
baseState | ||
} | ||
|
||
func (csiState csiParamState) Handle(b byte) (s state, e error) { | ||
logger.Infof("CsiParam::Handle %#x", b) | ||
|
||
nextState, err := csiState.baseState.Handle(b) | ||
if nextState != nil || err != nil { | ||
return nextState, err | ||
} | ||
|
||
switch { | ||
case sliceContains(alphabetics, b): | ||
return csiState.parser.ground, nil | ||
case sliceContains(csiCollectables, b): | ||
csiState.parser.collectParam() | ||
return csiState, nil | ||
case sliceContains(executors, b): | ||
return csiState, csiState.parser.execute() | ||
} | ||
|
||
return csiState, nil | ||
} | ||
|
||
func (csiState csiParamState) Transition(s state) error { | ||
logger.Infof("CsiParam::Transition %s --> %s", csiState.Name(), s.Name()) | ||
csiState.baseState.Transition(s) | ||
|
||
switch s { | ||
case csiState.parser.ground: | ||
return csiState.parser.csiDispatch() | ||
} | ||
|
||
return nil | ||
} |
36 changes: 36 additions & 0 deletions
36
deps/github.com/Azure/go-ansiterm/escape_intermediate_state.go
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,36 @@ | ||
package ansiterm | ||
|
||
type escapeIntermediateState struct { | ||
baseState | ||
} | ||
|
||
func (escState escapeIntermediateState) Handle(b byte) (s state, e error) { | ||
logger.Infof("escapeIntermediateState::Handle %#x", b) | ||
nextState, err := escState.baseState.Handle(b) | ||
if nextState != nil || err != nil { | ||
return nextState, err | ||
} | ||
|
||
switch { | ||
case sliceContains(intermeds, b): | ||
return escState, escState.parser.collectInter() | ||
case sliceContains(executors, b): | ||
return escState, escState.parser.execute() | ||
case sliceContains(escapeIntermediateToGroundBytes, b): | ||
return escState.parser.ground, nil | ||
} | ||
|
||
return escState, nil | ||
} | ||
|
||
func (escState escapeIntermediateState) Transition(s state) error { | ||
logger.Infof("escapeIntermediateState::Transition %s --> %s", escState.Name(), s.Name()) | ||
escState.baseState.Transition(s) | ||
|
||
switch s { | ||
case escState.parser.ground: | ||
return escState.parser.escDispatch() | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.