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.
66 lines
2.0 KiB
Go
66 lines
2.0 KiB
Go
package reflect2
|
|
|
|
import (
|
|
"reflect"
|
|
"unsafe"
|
|
)
|
|
|
|
type UnsafeArrayType struct {
|
|
unsafeType
|
|
elemRType unsafe.Pointer
|
|
pElemRType unsafe.Pointer
|
|
elemSize uintptr
|
|
likePtr bool
|
|
}
|
|
|
|
func newUnsafeArrayType(cfg *frozenConfig, type1 reflect.Type) *UnsafeArrayType {
|
|
return &UnsafeArrayType{
|
|
unsafeType: *newUnsafeType(cfg, type1),
|
|
elemRType: unpackEFace(type1.Elem()).data,
|
|
pElemRType: unpackEFace(reflect.PtrTo(type1.Elem())).data,
|
|
elemSize: type1.Elem().Size(),
|
|
likePtr: likePtrType(type1),
|
|
}
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) LikePtr() bool {
|
|
return type2.likePtr
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) Indirect(obj interface{}) interface{} {
|
|
objEFace := unpackEFace(obj)
|
|
assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype)
|
|
return type2.UnsafeIndirect(objEFace.data)
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) UnsafeIndirect(ptr unsafe.Pointer) interface{} {
|
|
if type2.likePtr {
|
|
return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr))
|
|
}
|
|
return packEFace(type2.rtype, ptr)
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) SetIndex(obj interface{}, index int, elem interface{}) {
|
|
objEFace := unpackEFace(obj)
|
|
assertType("ArrayType.SetIndex argument 1", type2.ptrRType, objEFace.rtype)
|
|
elemEFace := unpackEFace(elem)
|
|
assertType("ArrayType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype)
|
|
type2.UnsafeSetIndex(objEFace.data, index, elemEFace.data)
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) {
|
|
elemPtr := arrayAt(obj, index, type2.elemSize, "i < s.Len")
|
|
typedmemmove(type2.elemRType, elemPtr, elem)
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) GetIndex(obj interface{}, index int) interface{} {
|
|
objEFace := unpackEFace(obj)
|
|
assertType("ArrayType.GetIndex argument 1", type2.ptrRType, objEFace.rtype)
|
|
elemPtr := type2.UnsafeGetIndex(objEFace.data, index)
|
|
return packEFace(type2.pElemRType, elemPtr)
|
|
}
|
|
|
|
func (type2 *UnsafeArrayType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer {
|
|
return arrayAt(obj, index, type2.elemSize, "i < s.Len")
|
|
}
|