From 4223fd24b493dc8a9ae4af1495cdd18319b21c4c Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Fri, 25 Jan 2019 11:17:31 -0500 Subject: [PATCH 1/3] first attempt at converting to proto3 and some housekeeping --- proto/certificate.proto | 20 ---- proto/channel.proto | 7 ++ proto/claim.proto | 26 ++--- proto/fee.proto | 16 ++- proto/file.proto | 8 ++ proto/metadata.proto | 214 ---------------------------------------- proto/signature.proto | 16 --- proto/source.proto | 18 ---- proto/stream.proto | 29 +++--- 9 files changed, 49 insertions(+), 305 deletions(-) delete mode 100644 proto/certificate.proto create mode 100644 proto/channel.proto create mode 100644 proto/file.proto delete mode 100644 proto/metadata.proto delete mode 100644 proto/signature.proto delete mode 100644 proto/source.proto diff --git a/proto/certificate.proto b/proto/certificate.proto deleted file mode 100644 index 86fcac5..0000000 --- a/proto/certificate.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto2"; - -package pb; - -enum KeyType { - UNKNOWN_PUBLIC_KEY_TYPE = 0; - NIST256p = 1; - NIST384p = 2; - SECP256k1 = 3; -} - -message Certificate { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; - } - required Version version = 1; - required KeyType keyType = 2; - required bytes publicKey = 4; -} diff --git a/proto/channel.proto b/proto/channel.proto new file mode 100644 index 0000000..db92a2b --- /dev/null +++ b/proto/channel.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package pb; + +message Channel { + bytes public_key = 1; +} diff --git a/proto/claim.proto b/proto/claim.proto index ff590f1..3e7b6e1 100644 --- a/proto/claim.proto +++ b/proto/claim.proto @@ -1,24 +1,18 @@ -syntax = "proto2"; +syntax = "proto3"; package pb; import "stream.proto"; -import "certificate.proto"; -import "signature.proto"; +import "channel.proto"; message Claim { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; + enum Type { + UNKNOWN = 0; + STREAM = 1; + CHANNEL = 2; } - required Version version = 1; - enum ClaimType { - UNKNOWN_CLAIM_TYPE = 0; - streamType = 1; - certificateType = 2; - } - required ClaimType claimType = 2; - optional Stream stream = 3; - optional Certificate certificate = 4; - optional Signature publisherSignature = 5; + + Type type = 1; // do we need this? + Stream stream = 2; + Channel channel = 3; } diff --git a/proto/fee.proto b/proto/fee.proto index dedbd8c..9ecdbf8 100644 --- a/proto/fee.proto +++ b/proto/fee.proto @@ -1,20 +1,16 @@ -syntax = "proto2"; +syntax = "proto3"; package pb; message Fee { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; - } enum Currency { - UNKNOWN_CURRENCY = 0; + UNKNOWN = 0; LBC = 1; BTC = 2; USD = 3; } - required Version version = 1; - required Currency currency = 2; - required bytes address = 3; - required float amount = 4; + + Currency currency = 1; + bytes address = 2; + float amount = 3; } diff --git a/proto/file.proto b/proto/file.proto new file mode 100644 index 0000000..4cc52d1 --- /dev/null +++ b/proto/file.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +package pb; + +message File { + string name = 1; + uint64 size = 2; +} diff --git a/proto/metadata.proto b/proto/metadata.proto deleted file mode 100644 index 618a5f2..0000000 --- a/proto/metadata.proto +++ /dev/null @@ -1,214 +0,0 @@ -syntax = "proto2"; - -package pb; - -import "fee.proto"; - -message Metadata { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; - _0_0_2 = 2; - _0_0_3 = 3; - _0_1_0 = 4; - } - enum Language { - UNKNOWN_LANGUAGE = 0; - en = 1; - aa = 2; - ab = 3; - ae = 4; - af = 5; - ak = 6; - am = 7; - an = 8; - ar = 9; - as = 10; - av = 11; - ay = 12; - az = 13; - ba = 14; - be = 15; - bg = 16; - bh = 17; - bi = 18; - bm = 19; - bn = 20; - bo = 21; - br = 22; - bs = 23; - ca = 24; - ce = 25; - ch = 26; - co = 27; - cr = 28; - cs = 29; - cu = 30; - cv = 31; - cy = 32; - da = 33; - de = 34; - dv = 35; - dz = 36; - ee = 37; - el = 38; - eo = 39; - es = 40; - et = 41; - eu = 42; - fa = 43; - ff = 44; - fi = 45; - fj = 46; - fo = 47; - fr = 48; - fy = 49; - ga = 50; - gd = 51; - gl = 52; - gn = 53; - gu = 54; - gv = 55; - ha = 56; - he = 57; - hi = 58; - ho = 59; - hr = 60; - ht = 61; - hu = 62; - hy = 63; - hz = 64; - ia = 65; - id = 66; - ie = 67; - ig = 68; - ii = 69; - ik = 70; - io = 71; - is = 72; - it = 73; - iu = 74; - ja = 75; - jv = 76; - ka = 77; - kg = 78; - ki = 79; - kj = 80; - kk = 81; - kl = 82; - km = 83; - kn = 84; - ko = 85; - kr = 86; - ks = 87; - ku = 88; - kv = 89; - kw = 90; - ky = 91; - la = 92; - lb = 93; - lg = 94; - li = 95; - ln = 96; - lo = 97; - lt = 98; - lu = 99; - lv = 100; - mg = 101; - mh = 102; - mi = 103; - mk = 104; - ml = 105; - mn = 106; - mr = 107; - ms = 108; - mt = 109; - my = 110; - na = 111; - nb = 112; - nd = 113; - ne = 114; - ng = 115; - nl = 116; - nn = 117; - no = 118; - nr = 119; - nv = 120; - ny = 121; - oc = 122; - oj = 123; - om = 124; - or = 125; - os = 126; - pa = 127; - pi = 128; - pl = 129; - ps = 130; - pt = 131; - qu = 132; - rm = 133; - rn = 134; - ro = 135; - ru = 136; - rw = 137; - sa = 138; - sc = 139; - sd = 140; - se = 141; - sg = 142; - si = 143; - sk = 144; - sl = 145; - sm = 146; - sn = 147; - so = 148; - sq = 149; - sr = 150; - ss = 151; - st = 152; - su = 153; - sv = 154; - sw = 155; - ta = 156; - te = 157; - tg = 158; - th = 159; - ti = 160; - tk = 161; - tl = 162; - tn = 163; - to = 164; - tr = 165; - ts = 166; - tt = 167; - tw = 168; - ty = 169; - ug = 170; - uk = 171; - ur = 172; - uz = 173; - ve = 174; - vi = 175; - vo = 176; - wa = 177; - wo = 178; - xh = 179; - yi = 180; - yo = 181; - za = 182; - zh = 183; - zu = 184; - } - required Version version = 1; - required Language language = 2; - required string title = 3; - required string description = 4; - required string author = 5; - required string license = 6; - required bool nsfw = 7; - - optional Fee fee = 8; - optional string thumbnail = 9; - optional string preview = 10; - optional string licenseUrl = 11; -} diff --git a/proto/signature.proto b/proto/signature.proto deleted file mode 100644 index 9ebfc0b..0000000 --- a/proto/signature.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto2"; - -package pb; - -import "certificate.proto"; - -message Signature { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; - } - required Version version = 1; - required KeyType signatureType = 2; - required bytes signature = 3; - required bytes certificateId = 4; -} diff --git a/proto/source.proto b/proto/source.proto deleted file mode 100644 index 4d2b1dc..0000000 --- a/proto/source.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -package pb; - -message Source { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; - } - required Version version = 1; - enum SourceTypes { - UNKNOWN_SOURCE_TYPE = 0; - lbry_sd_hash = 1; - } - required SourceTypes sourceType = 2; - required bytes source = 3; - required string contentType = 4; -} diff --git a/proto/stream.proto b/proto/stream.proto index c6c666a..73a37e9 100644 --- a/proto/stream.proto +++ b/proto/stream.proto @@ -1,17 +1,24 @@ -syntax = "proto2"; +syntax = "proto3"; package pb; -import "metadata.proto"; -import "source.proto"; - +import "fee.proto"; +import "file.proto"; message Stream { - enum Version { - UNKNOWN_VERSION = 0; - _0_0_1 = 1; - } - required Version version = 1; - required Metadata metadata = 2; - required Source source = 3; + bytes hash = 1; + string language = 2; + string title = 3; + string author = 4; + string description = 5; + string media_type = 6; + string license = 7; + File file = 8; + + Fee fee = 16; + string license_url = 17; + string thumbnail = 18; + string preview = 19; + bool nsfw = 20; + uint32 duration = 21; } -- 2.45.2 From 69807aaae5ebef44deeb17aeb8d1fc454277be86 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 14 Feb 2019 09:55:47 -0500 Subject: [PATCH 2/3] more changes --- proto/channel.proto | 4 ++++ proto/claim.proto | 5 ++--- proto/fee.proto | 7 +++---- proto/stream.proto | 7 +++---- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/proto/channel.proto b/proto/channel.proto index db92a2b..347f853 100644 --- a/proto/channel.proto +++ b/proto/channel.proto @@ -4,4 +4,8 @@ package pb; message Channel { bytes public_key = 1; + string name = 2; + string description = 3; + string thumbnail_url = 4; // url or claim ID? + string cover_url = 5; // url or claim ID? } diff --git a/proto/claim.proto b/proto/claim.proto index 3e7b6e1..9362748 100644 --- a/proto/claim.proto +++ b/proto/claim.proto @@ -7,9 +7,8 @@ import "channel.proto"; message Claim { enum Type { - UNKNOWN = 0; - STREAM = 1; - CHANNEL = 2; + STREAM = 0; + CHANNEL = 1; } Type type = 1; // do we need this? diff --git a/proto/fee.proto b/proto/fee.proto index 9ecdbf8..9ba2851 100644 --- a/proto/fee.proto +++ b/proto/fee.proto @@ -4,10 +4,9 @@ package pb; message Fee { enum Currency { - UNKNOWN = 0; - LBC = 1; - BTC = 2; - USD = 3; + LBC = 0; + BTC = 1; + USD = 2; } Currency currency = 1; diff --git a/proto/stream.proto b/proto/stream.proto index 73a37e9..eb5d2cc 100644 --- a/proto/stream.proto +++ b/proto/stream.proto @@ -17,8 +17,7 @@ message Stream { Fee fee = 16; string license_url = 17; - string thumbnail = 18; - string preview = 19; - bool nsfw = 20; - uint32 duration = 21; + string thumbnail_url = 18; + uint32 duration = 19; + repeated string tags = 20; } -- 2.45.2 From 5640bece22226a99a6ef9e88cd8c73e481b43dac Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Wed, 27 Feb 2019 11:37:12 -0500 Subject: [PATCH 3/3] release time --- proto/stream.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/stream.proto b/proto/stream.proto index eb5d2cc..77a1051 100644 --- a/proto/stream.proto +++ b/proto/stream.proto @@ -20,4 +20,5 @@ message Stream { string thumbnail_url = 18; uint32 duration = 19; repeated string tags = 20; + int64 release_time = 21; // seconds since UNIX epoch } -- 2.45.2