我一直在疯狂地试图找到一个模块,我可以使用嵌套对象,特别是类.有一些模块非常接近,但我不想将属性设置为null以跳过我不想要的值.
如果我能写一个TO_JSON方法,那将是很好的返回一个将由模块封送的结构.或者,只需对我们不希望包含在最终JSON文档中的属性使用"json-skip".
就像是:
class Something {
has Str $.foo;
has Str $.bar is json-skip;
}
Run Code Online (Sandbox Code Playgroud)
要么
class Something {
has Str $.foo;
has Str $.bar;
method TO_JSON {
return {
foo => $.foo
}
}
}
Run Code Online (Sandbox Code Playgroud)
JSON :: Tiny,JSON :: Fast,JSON :: Marshal等......所有这些都适用于单独的结构,有些甚至可以使用嵌套实例,但是排除属性是目前无法解决的问题.
最后我想做的事情如下:
my $json-document = to-json(@nestedInstances);
Run Code Online (Sandbox Code Playgroud) 假设一个人有A :: Very :: Shallow :: ClassA和A :: Very :: Deep :: ClassB
文件:./A/Very/Shallow/ClassA.pm6
class A::Very::Shallow::ClassA{
has Str $.label is rw;
has Str $.icon is rw;
has @.items is rw;
}
Run Code Online (Sandbox Code Playgroud)
我想继承ClassB中的ClassA,所以我写道:
文件:./A/Very/Deep/ClassB.pm6
class A::Very::Deep::ClassB is A::Very::Shallow::ClassA{
...
}
Run Code Online (Sandbox Code Playgroud)
然而,错误与:
Cannot resolve caller trait_mod:<is>(A::Very::Deep::ClassB, A::Very::Shallow::ClassA, Hash); none of these signatures match:
(Mu:U $child, Mu:U $parent)
(Mu:U $child, :$DEPRECATED!)
(Mu:U $type, :$rw!)
(Mu:U $type, :$nativesize!)
(Mu:U $type, :$ctype!)
(Mu:U $type, :$unsigned!)
(Mu:U $type, :$hidden!)
(Mu:U $type, Mu :$array_type!)
(Mu:U $type, *%fail) …
Run Code Online (Sandbox Code Playgroud) 无论我做什么,似乎都无法摆脱这个问题。我已经使用 kubeadm 多次成功安装 Kubernetes,但是添加 v1.16.0 节点让我非常头疼。
操作系统:Ubuntu 18.04.3 LTS Kubernetes 版本:v1.16.0 Kubeadm 版本:主要:“1”,次要:“16”,GitVersion:“v1.16.0”,GitCommit:“2bd9643cee5b3b3a5ecbd3af49d09018f0773c77”,GitTreeState:“clean”,构建日期:“2019-09-18T14:34:01Z”,Go版本:“go1.12.9”,编译器:“gc”,平台:“linux/amd64”
集群查询显示:
NAME STATUS ROLES AGE VERSION
kube-apiserver-1 Ready master 110d v1.15.0
kube-apiserver-2 Ready master 110d v1.15.0
kube-apiserver-3 Ready master 110d v1.15.0
kube-node-1 Ready <none> 110d v1.15.0
kube-node-2 Ready <none> 110d v1.15.0
kube-node-3 Ready <none> 110d v1.15.0
kube-node-4 Ready <none> 110d v1.16.0
kube-node-5 Ready,SchedulingDisabled <none> 3m28s v1.16.0
kube-node-databases Ready <none> 110d v1.15.0
Run Code Online (Sandbox Code Playgroud)
我已暂时禁用对节点的调度,直到解决此问题为止。查询 kube-system 命名空间中的 pod 状态会显示问题:
$ kubectl -n kube-system 获取 Pod
NAME READY STATUS RESTARTS AGE …
Run Code Online (Sandbox Code Playgroud)