mirror of
https://github.com/hanzoai/volume.git
synced 2026-10-01 00:48:00 +00:00
A fork of Rancher's local-path-provisioner at v0.0.36. The behaviour is unchanged and deliberately so — a directory on the node a pod lands on is the right thing for a disk. What changes is identity. The provisioner answers to hanzo.ai/volume rather than rancher.io/local-path. That is not branding: two provisioners sharing one name race for the same claims, and a stock k3s carries the upstream one, so a cluster running both would settle our storage by chance. Data lives at /var/lib/hanzo/volume, so reading a Hanzo cluster does not mean learning another vendor's directory. Apache-2.0 as published, unaltered, with Rancher's attribution in NOTICE. The README says what this is not: durability. A volume here dies with its node. That is hanzoai/replicate's question, one layer up, and keeping the two apart is what lets the disk stay this simple.
100 lines
2.0 KiB
Go
100 lines
2.0 KiB
Go
//+build !jsoniter_sloppy
|
|
|
|
package jsoniter
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
func (iter *Iterator) skipNumber() {
|
|
if !iter.trySkipNumber() {
|
|
iter.unreadByte()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
return
|
|
}
|
|
iter.ReadFloat64()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
iter.Error = nil
|
|
iter.ReadBigFloat()
|
|
}
|
|
}
|
|
}
|
|
|
|
func (iter *Iterator) trySkipNumber() bool {
|
|
dotFound := false
|
|
for i := iter.head; i < iter.tail; i++ {
|
|
c := iter.buf[i]
|
|
switch c {
|
|
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
|
|
case '.':
|
|
if dotFound {
|
|
iter.ReportError("validateNumber", `more than one dot found in number`)
|
|
return true // already failed
|
|
}
|
|
if i+1 == iter.tail {
|
|
return false
|
|
}
|
|
c = iter.buf[i+1]
|
|
switch c {
|
|
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
|
|
default:
|
|
iter.ReportError("validateNumber", `missing digit after dot`)
|
|
return true // already failed
|
|
}
|
|
dotFound = true
|
|
default:
|
|
switch c {
|
|
case ',', ']', '}', ' ', '\t', '\n', '\r':
|
|
if iter.head == i {
|
|
return false // if - without following digits
|
|
}
|
|
iter.head = i
|
|
return true // must be valid
|
|
}
|
|
return false // may be invalid
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (iter *Iterator) skipString() {
|
|
if !iter.trySkipString() {
|
|
iter.unreadByte()
|
|
iter.ReadString()
|
|
}
|
|
}
|
|
|
|
func (iter *Iterator) trySkipString() bool {
|
|
for i := iter.head; i < iter.tail; i++ {
|
|
c := iter.buf[i]
|
|
if c == '"' {
|
|
iter.head = i + 1
|
|
return true // valid
|
|
} else if c == '\\' {
|
|
return false
|
|
} else if c < ' ' {
|
|
iter.ReportError("trySkipString",
|
|
fmt.Sprintf(`invalid control character found: %d`, c))
|
|
return true // already failed
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (iter *Iterator) skipObject() {
|
|
iter.unreadByte()
|
|
iter.ReadObjectCB(func(iter *Iterator, field string) bool {
|
|
iter.Skip()
|
|
return true
|
|
})
|
|
}
|
|
|
|
func (iter *Iterator) skipArray() {
|
|
iter.unreadByte()
|
|
iter.ReadArrayCB(func(iter *Iterator) bool {
|
|
iter.Skip()
|
|
return true
|
|
})
|
|
}
|