diff --git a/README.md b/README.md index 3294fde..b317d55 100644 --- a/README.md +++ b/README.md @@ -2,38 +2,7 @@ Cross-language definitions for standard LBRY types. -## Using LBRY types in your code - -### Go - -```go -package main - -import pb "github.com/lbryio/types/go" -import "fmt" - -func main() { - title := "Coherence" - metadata := pb.Metadata{Title:&title} - fmt.Printf("Let's watch %s on LBRY!\n", metadata.GetTitle()) -} - -``` - -### Python - -todo - -### Javascript - -todo - -## Compiling types - -You only need to do this if you're modifying the types themselves. - -- Download [the protoc binary](https://github.com/google/protobuf/releases) and put it in your path. Make sure you get the one starting with `protoc`, not `protobuf`. -- `./build.sh` +`v1/` contains the old proto2 files. `v2/` contains the new proto3 files. See the README.md file in each dir for instructions on using each. ## License diff --git a/v1/README.md b/v1/README.md new file mode 100644 index 0000000..f1de486 --- /dev/null +++ b/v1/README.md @@ -0,0 +1,32 @@ +# Using LBRY types in your code + +## Go + +```go +package main + +import pb "github.com/lbryio/types/go" +import "fmt" + +func main() { + title := "Coherence" + metadata := pb.Metadata{Title:&title} + fmt.Printf("Let's watch %s on LBRY!\n", metadata.GetTitle()) +} + +``` + +## Python + +todo + +## Javascript + +todo + +# Compiling types + +You only need to do this if you're modifying the types themselves. + +- Download [the protoc binary](https://github.com/google/protobuf/releases) and put it in your path. Make sure you get the one starting with `protoc`, not `protobuf`. +- `./build.sh` \ No newline at end of file diff --git a/build.sh b/v1/build.sh similarity index 100% rename from build.sh rename to v1/build.sh diff --git a/cpp/certificate.pb.cc b/v1/cpp/certificate.pb.cc similarity index 100% rename from cpp/certificate.pb.cc rename to v1/cpp/certificate.pb.cc diff --git a/cpp/certificate.pb.h b/v1/cpp/certificate.pb.h similarity index 100% rename from cpp/certificate.pb.h rename to v1/cpp/certificate.pb.h diff --git a/cpp/claim.pb.cc b/v1/cpp/claim.pb.cc similarity index 100% rename from cpp/claim.pb.cc rename to v1/cpp/claim.pb.cc diff --git a/cpp/claim.pb.h b/v1/cpp/claim.pb.h similarity index 100% rename from cpp/claim.pb.h rename to v1/cpp/claim.pb.h diff --git a/cpp/fee.pb.cc b/v1/cpp/fee.pb.cc similarity index 100% rename from cpp/fee.pb.cc rename to v1/cpp/fee.pb.cc diff --git a/cpp/fee.pb.h b/v1/cpp/fee.pb.h similarity index 100% rename from cpp/fee.pb.h rename to v1/cpp/fee.pb.h diff --git a/cpp/metadata.pb.cc b/v1/cpp/metadata.pb.cc similarity index 100% rename from cpp/metadata.pb.cc rename to v1/cpp/metadata.pb.cc diff --git a/cpp/metadata.pb.h b/v1/cpp/metadata.pb.h similarity index 100% rename from cpp/metadata.pb.h rename to v1/cpp/metadata.pb.h diff --git a/cpp/signature.pb.cc b/v1/cpp/signature.pb.cc similarity index 100% rename from cpp/signature.pb.cc rename to v1/cpp/signature.pb.cc diff --git a/cpp/signature.pb.h b/v1/cpp/signature.pb.h similarity index 100% rename from cpp/signature.pb.h rename to v1/cpp/signature.pb.h diff --git a/cpp/source.pb.cc b/v1/cpp/source.pb.cc similarity index 100% rename from cpp/source.pb.cc rename to v1/cpp/source.pb.cc diff --git a/cpp/source.pb.h b/v1/cpp/source.pb.h similarity index 100% rename from cpp/source.pb.h rename to v1/cpp/source.pb.h diff --git a/cpp/stream.pb.cc b/v1/cpp/stream.pb.cc similarity index 100% rename from cpp/stream.pb.cc rename to v1/cpp/stream.pb.cc diff --git a/cpp/stream.pb.h b/v1/cpp/stream.pb.h similarity index 100% rename from cpp/stream.pb.h rename to v1/cpp/stream.pb.h diff --git a/go/certificate.pb.go b/v1/go/certificate.pb.go similarity index 100% rename from go/certificate.pb.go rename to v1/go/certificate.pb.go diff --git a/go/claim.pb.go b/v1/go/claim.pb.go similarity index 100% rename from go/claim.pb.go rename to v1/go/claim.pb.go diff --git a/go/fee.pb.go b/v1/go/fee.pb.go similarity index 100% rename from go/fee.pb.go rename to v1/go/fee.pb.go diff --git a/go/metadata.pb.go b/v1/go/metadata.pb.go similarity index 100% rename from go/metadata.pb.go rename to v1/go/metadata.pb.go diff --git a/go/signature.pb.go b/v1/go/signature.pb.go similarity index 100% rename from go/signature.pb.go rename to v1/go/signature.pb.go diff --git a/go/source.pb.go b/v1/go/source.pb.go similarity index 100% rename from go/source.pb.go rename to v1/go/source.pb.go diff --git a/go/stream.pb.go b/v1/go/stream.pb.go similarity index 100% rename from go/stream.pb.go rename to v1/go/stream.pb.go diff --git a/js/certificate_pb.js b/v1/js/certificate_pb.js similarity index 100% rename from js/certificate_pb.js rename to v1/js/certificate_pb.js diff --git a/js/claim_pb.js b/v1/js/claim_pb.js similarity index 100% rename from js/claim_pb.js rename to v1/js/claim_pb.js diff --git a/js/fee_pb.js b/v1/js/fee_pb.js similarity index 100% rename from js/fee_pb.js rename to v1/js/fee_pb.js diff --git a/js/metadata_pb.js b/v1/js/metadata_pb.js similarity index 100% rename from js/metadata_pb.js rename to v1/js/metadata_pb.js diff --git a/js/signature_pb.js b/v1/js/signature_pb.js similarity index 100% rename from js/signature_pb.js rename to v1/js/signature_pb.js diff --git a/js/source_pb.js b/v1/js/source_pb.js similarity index 100% rename from js/source_pb.js rename to v1/js/source_pb.js diff --git a/js/stream_pb.js b/v1/js/stream_pb.js similarity index 100% rename from js/stream_pb.js rename to v1/js/stream_pb.js diff --git a/proto/certificate.proto b/v1/proto/certificate.proto similarity index 100% rename from proto/certificate.proto rename to v1/proto/certificate.proto diff --git a/proto/claim.proto b/v1/proto/claim.proto similarity index 100% rename from proto/claim.proto rename to v1/proto/claim.proto diff --git a/proto/fee.proto b/v1/proto/fee.proto similarity index 100% rename from proto/fee.proto rename to v1/proto/fee.proto diff --git a/proto/metadata.proto b/v1/proto/metadata.proto similarity index 100% rename from proto/metadata.proto rename to v1/proto/metadata.proto diff --git a/proto/signature.proto b/v1/proto/signature.proto similarity index 100% rename from proto/signature.proto rename to v1/proto/signature.proto diff --git a/proto/source.proto b/v1/proto/source.proto similarity index 100% rename from proto/source.proto rename to v1/proto/source.proto diff --git a/proto/stream.proto b/v1/proto/stream.proto similarity index 100% rename from proto/stream.proto rename to v1/proto/stream.proto diff --git a/python/certificate_pb2.py b/v1/python/certificate_pb2.py similarity index 100% rename from python/certificate_pb2.py rename to v1/python/certificate_pb2.py diff --git a/python/claim_pb2.py b/v1/python/claim_pb2.py similarity index 100% rename from python/claim_pb2.py rename to v1/python/claim_pb2.py diff --git a/python/fee_pb2.py b/v1/python/fee_pb2.py similarity index 100% rename from python/fee_pb2.py rename to v1/python/fee_pb2.py diff --git a/python/metadata_pb2.py b/v1/python/metadata_pb2.py similarity index 100% rename from python/metadata_pb2.py rename to v1/python/metadata_pb2.py diff --git a/python/signature_pb2.py b/v1/python/signature_pb2.py similarity index 100% rename from python/signature_pb2.py rename to v1/python/signature_pb2.py diff --git a/python/source_pb2.py b/v1/python/source_pb2.py similarity index 100% rename from python/source_pb2.py rename to v1/python/source_pb2.py diff --git a/python/stream_pb2.py b/v1/python/stream_pb2.py similarity index 100% rename from python/stream_pb2.py rename to v1/python/stream_pb2.py diff --git a/v2/README.md b/v2/README.md new file mode 100644 index 0000000..f1de486 --- /dev/null +++ b/v2/README.md @@ -0,0 +1,32 @@ +# Using LBRY types in your code + +## Go + +```go +package main + +import pb "github.com/lbryio/types/go" +import "fmt" + +func main() { + title := "Coherence" + metadata := pb.Metadata{Title:&title} + fmt.Printf("Let's watch %s on LBRY!\n", metadata.GetTitle()) +} + +``` + +## Python + +todo + +## Javascript + +todo + +# Compiling types + +You only need to do this if you're modifying the types themselves. + +- Download [the protoc binary](https://github.com/google/protobuf/releases) and put it in your path. Make sure you get the one starting with `protoc`, not `protobuf`. +- `./build.sh` \ No newline at end of file diff --git a/v2/build.sh b/v2/build.sh new file mode 100755 index 0000000..51c612d --- /dev/null +++ b/v2/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -euo pipefail +#set -x + +version_gte() { + [ "$1" = "$(echo -e "$1\n$2" | sort -V | tail -n1)" ] +} + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + + +hash protoc 2>/dev/null || { echo >&2 -e 'error: protoc binary not found\nDownload it from https://github.com/google/protobuf/releases and put it in your path.\nMake sure you get the one starting with `protoc`, not `protobuf`.'; exit 1; } + + +PROTOC="$(which protoc)" +VERSION="$($PROTOC --version | cut -d' ' -f2)" +MIN_VERSION="3.0" + +version_gte "$VERSION" "$MIN_VERSION" || { echo >&2 "error: protoc version must be >= $MIN_VERSION (your $PROTOC is $VERSION)"; exit 1; } + + +hash protoc-gen-go 2>/dev/null || go get -u github.com/golang/protobuf/protoc-gen-go +hash protoc-gen-go 2>/dev/null || { echo >&2 'error: Make sure $GOPATH/bin is in your $PATH'; exit 1; } + + +mkdir -p $DIR/go $DIR/python $DIR/js $DIR/cpp +find $DIR/go $DIR/python $DIR/js $DIR/cpp -type f -delete + + +protoc --proto_path="$DIR/proto" --python_out="$DIR/python" --go_out="$DIR/go" --js_out="import_style=commonjs,binary:$DIR/js" --cpp_out="$DIR/cpp" $DIR/proto/*.proto diff --git a/v2/cpp/claim.pb.cc b/v2/cpp/claim.pb.cc new file mode 100644 index 0000000..2a9ac7a --- /dev/null +++ b/v2/cpp/claim.pb.cc @@ -0,0 +1,3728 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: claim.proto + +#include "claim.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Channel_claim_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Fee_claim_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_File_claim_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Video_claim_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::google::protobuf::internal::SCCInfo<3> scc_info_Stream_claim_2eproto; +namespace pb { +class ClaimDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed _instance; +} _Claim_default_instance_; +class ChannelDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed _instance; +} _Channel_default_instance_; +class StreamDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed _instance; +} _Stream_default_instance_; +class FeeDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed _instance; +} _Fee_default_instance_; +class FileDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed _instance; +} _File_default_instance_; +class VideoDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed