Yaml中的<<`和`&`是什么意思?

黑狗

当我查看cryptogenfabric命令)配置文件时。我看到那里的象征。

Profiles:

    SampleInsecureSolo:
        Orderer:
            <<: *OrdererDefaults  ## what is the `<<`
            Organizations:
                - *ExampleCom     ## what is the `*`
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1ExampleCom
                    - *Org2ExampleCom

上面有两个符号<<*

Application: &ApplicationDefaults  # what is the `&` mean

    Organizations:

如您所见,还有另一个符号&我不知道那是什么意思。即使查看源代码(fabric/common/configtx/tool/configtxgen/main.go),我也没有任何信息

阿尔特姆·巴格(Artem Barger)

好的,这些是YAML文件格式的元素,此处用于为提供配置文件configtxgen“&”符号表示锚,而对锚的引用是“ *”,基本上用于避免重复,例如:

person: &person
    name: "John Doe"

employee: &employee
    << : *person
    salary : 5000

将重用人员字段,其含义类似于:

employee: &employee
    name   : "John Doe"
    salary : 5000

另一个例子就是简单地重用值:

key1: &key some very common value

key2: *key

相当于:

key1: some very common value

key2: some very common value

由于abric/common/configtx/tool/configtxgen/main.go使用了架子YAML解析器,因此您不会在configtxgen相关代码中找到对这些符号的任何引用我建议阅读更多有关YAML文件格式的信息

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

##和%在shell中是什么意思?

在C ++中,^(){}和^ {}是什么意思?

[Prolog]中的[]和[_]是什么意思

=〜和/ \在Ruby中是什么意思?

“ >>”和“ <<”在python中是什么意思?

JavaScript中的$和$$是什么意思?

<%和%>在javascript中是什么意思?

什么| 和 || 在 Erlang 中是什么意思?

bash中if条件中的-s和[[]]是什么意思?

setDefaultMaxPerRoute和setMaxTotal在HttpClient中是什么意思?

iptables -L -v中“ in”和“ out”是什么意思

vi中的^ @,^ I和$是什么意思?

在netstat输出中,`0.0.0.0:*`,[[::]:mysql`和`[::]:*`是什么意思?

在Vim命令中\ @ <=和\ @ =是什么意思?

OpenNLP中培训的“截止”和“迭代”是什么意思?

生成文件中的$ @和$ <是什么意思?

在cornerHarris中ksize和k是什么意思?

在Express中,“静态”和“非静态”是什么意思?

Perl中的“ Cwd”和“ qw”是什么意思?

在C和C ++中,-0是什么意思?

在 TypeScript 中,“extends keyof”和“in keyof”是什么意思?

在Linux中,drwxrwxrwt。的d和t。是什么意思?

\%和\\在SQL查询中是什么意思?

htop屏幕中的“任务和运行”是什么意思?

JavaScript中的域和默认函数是什么意思?

$$和<generated>在java stacktrace中是什么意思?

getent组中的“!”,“ *”和“ x”是什么意思?

bash脚本中的“ 1 >>”和“ 2 >>”是什么意思?

括号和 $ 符号在 echo $(ls) 中是什么意思