Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 使用protoc解码google托管协议缓冲区数据存储/firestore导出_Firebase_Google Cloud Platform_Google Cloud Firestore_Protocol Buffers_Protoc - Fatal编程技术网

Firebase 使用protoc解码google托管协议缓冲区数据存储/firestore导出

Firebase 使用protoc解码google托管协议缓冲区数据存储/firestore导出,firebase,google-cloud-platform,google-cloud-firestore,protocol-buffers,protoc,Firebase,Google Cloud Platform,Google Cloud Firestore,Protocol Buffers,Protoc,我想我真的很接近或者我不明白我在做什么 我们在一个项目中使用Firestore,我正在编写一个自定义脚本来导出所有数据。但是可以通过gcloud CLI导出它。这很好,但是返回的数据在协议缓冲区&二进制中 我通过gcloud CLI导出了数据,如下所示 gcloud beta firestore export gs://[BUCKET_NAME] 它接受默认项目并导出您提供的bucket名称中的数据。结果是铲斗内部出现以下情况: - timestamp folder - timestamp

我想我真的很接近或者我不明白我在做什么

我们在一个项目中使用Firestore,我正在编写一个自定义脚本来导出所有数据。但是可以通过gcloud CLI导出它。这很好,但是返回的数据在协议缓冲区&二进制中

我通过gcloud CLI导出了数据,如下所示

gcloud beta firestore export gs://[BUCKET_NAME]
它接受默认项目并导出您提供的bucket名称中的数据。结果是铲斗内部出现以下情况:

- timestamp folder
  - timestamp.overall_export_metadata file
  - all_namespaces folder
    - all_kinds folder
      - all_namespaces_all_kinds.export_metadata file
      - output-0 file
      - output-1 file
      - ... > up until output-250 file
我下载了proto文件,并尝试用

protoc --decode google.firestore.v1beta1.Document ./google/firestore/v1beta1/document.proto < output-0 (or any other number for that matter)

resulted in: 

Failed to parse input.
proto——解码google.firestore.v1beta1.Document./google/firestore/v1beta1/Document.proto
以下命令起到了什么作用:

protoc --decode google.firestore.admin.v1beta1.ExportDocumentsMetadata ./google/firestore/admin/v1beta1/firestore_admin.proto < all_namespaces_all_kinds.export_metadata

resulted in:

start_time {
  nanos: 629329010
  1: "export_entities"
  3: 1565426104489599
}
end_time {
  1: "__all__"
  2: "output-0"
  2: "output-1"
  2: "output-2"
  ... etc, 2 stays the key, output-{number} changes until
  3 {
    1: "__all__"
  }
}

proto——解码google.firestore.admin.v1beta1.ExportDocumentsMetadata./google/firestore/admin/v1beta1/firestore\u admin.proto

protoc——解码\u原始

我缺少了一块拼图,因为我觉得我必须将所有的输出与元数据结合起来才能对其进行解码。但是我不知道如何…

这是一个将Firestore导出加载到本地模拟器的网关,我打赌。
protoc --decode_raw < all_namespaces_all_kinds.export_metadata

resulted in

1 {
  1: "export_entities"
  2: 1565426014407794
  3: 1565426104489599
}
2 {
  1: "__all__"
  2: "output-0"
  ... same as before until the 
  3 {
    1: "__all__"
  }
}