diff --git a/code/go/0chain.net/blobber/go.mod b/code/go/0chain.net/blobber/go.mod index 1150ae630..1c70c2e89 100644 --- a/code/go/0chain.net/blobber/go.mod +++ b/code/go/0chain.net/blobber/go.mod @@ -15,6 +15,9 @@ require ( github.com/gorilla/mux v1.7.3 github.com/spf13/viper v1.7.0 go.uber.org/zap v1.15.0 + golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect + golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa // indirect + google.golang.org/grpc v1.33.1 ) go 1.13 diff --git a/code/go/0chain.net/blobber/go.sum b/code/go/0chain.net/blobber/go.sum index c113f8ca8..5a4ab73cd 100644 --- a/code/go/0chain.net/blobber/go.sum +++ b/code/go/0chain.net/blobber/go.sum @@ -25,6 +25,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -33,8 +34,10 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -55,6 +58,10 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/didip/tollbooth v4.0.2+incompatible h1:fVSa33JzSz0hoh2NxpwZtksAzAgd7zjmGO20HCZtF4M= github.com/didip/tollbooth v4.0.2+incompatible/go.mod h1:A9b0665CE6l1KmzpDws2++elm/CsuWBMa5Jv4WY0PEY= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -83,14 +90,21 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -103,9 +117,12 @@ github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/h2non/filetype v1.0.9 h1:Y9YFg/WJNd7XoC5h3WD+GZSxHmuRRDyJQ7fcIlIJplI= github.com/h2non/filetype v1.0.9/go.mod h1:isekKqOuhMj+s/7r3rIeTErIRy4Rub5uBWHfvMusLMU= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= @@ -267,6 +284,7 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -275,6 +293,7 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce h1:aP+C+YbHZfOQlutA4p4soHi7rVUqHQdWEVMSkHfDTqY= github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce/go.mod h1:3j2R4OIe/SeS6YDhICBy22RWjJC5eNCJ1V+9+NVNYlo= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= @@ -383,6 +402,7 @@ golang.org/x/mobile v0.0.0-20200329125638-4c31acba0007/go.mod h1:skQtrUTUwhdJvXM golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd h1:ePuNC7PZ6O5BzgPn9bZayERXBdfZjUYoXEf5BTfDfh8= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -404,9 +424,12 @@ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -435,6 +458,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -454,6 +479,7 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -467,6 +493,8 @@ golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69 h1:yBHHx+XZqXJBm6Exke3N7V9gnlsyXxoCPEb1yVenjfk= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa h1:5E4dL8+NgFOgjwbTKz+OOEGGhP+ectTmF842l6KjupQ= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -491,11 +519,22 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 h1:fiNLklpBwWK1mth30Hlwk+fcdBmIALlgF5iy77O37Ig= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= @@ -512,6 +551,7 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gorm.io/datatypes v0.0.0-20200806042100-bc394008dd0d h1:cEzkQplur9Z++gqjh48MF692Hkdl/jTkbo/7YQ5yssM= @@ -534,6 +574,7 @@ gorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/code/go/0chain.net/blobber/main.go b/code/go/0chain.net/blobber/main.go index 531742436..634e6427a 100644 --- a/code/go/0chain.net/blobber/main.go +++ b/code/go/0chain.net/blobber/main.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "log" + "net" "net/http" "net/url" "os" @@ -232,6 +233,7 @@ func main() { metadataDB = flag.String("db_dir", "", "db_dir") logDir := flag.String("log_dir", "", "log_dir") portString := flag.String("port", "", "port") + grpcPortString := flag.String("grpc_port", "", "grpc_port") hostname := flag.String("hostname", "", "hostname") flag.Parse() @@ -266,6 +268,10 @@ func main() { panic("Please specify --port which is the port on which requests are accepted") } + if *grpcPortString == "" { + panic("Please specify --grpc_port which is the grpc port on which requests are accepted") + } + reader, err := os.Open(*keysFile) if err != nil { panic(err) @@ -346,6 +352,9 @@ func main() { initHandlers(r) initServer() + grpcServer := handler.NewServerWithMiddlewares() + handler.RegisterGRPCServices(r, grpcServer) + rHandler := handlers.CORS(originsOk, headersOk, methodsOk)(r) if config.Development() { // No WriteTimeout setup to enable pprof @@ -370,6 +379,13 @@ func main() { Logger.Info("Ready to listen to the requests") startTime = time.Now().UTC() + go func(grpcPort string) { + lis, err := net.Listen("tcp", fmt.Sprintf(":%s", grpcPort)) + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + log.Fatal(grpcServer.Serve(lis)) + }(*grpcPortString) log.Fatal(server.ListenAndServe()) } diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go new file mode 100644 index 000000000..08cf4528d --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -0,0 +1,2507 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 +// source: blobber.proto + +package blobbergrpc + +import ( + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type GetObjectPathRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` + Allocation string `protobuf:"bytes,2,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,3,opt,name=Path,proto3" json:"Path,omitempty"` + BlockNum string `protobuf:"bytes,4,opt,name=BlockNum,proto3" json:"BlockNum,omitempty"` +} + +func (x *GetObjectPathRequest) Reset() { + *x = GetObjectPathRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetObjectPathRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectPathRequest) ProtoMessage() {} + +func (x *GetObjectPathRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectPathRequest.ProtoReflect.Descriptor instead. +func (*GetObjectPathRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{0} +} + +func (x *GetObjectPathRequest) GetContext() *RequestContext { + if x != nil { + return x.Context + } + return nil +} + +func (x *GetObjectPathRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +func (x *GetObjectPathRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *GetObjectPathRequest) GetBlockNum() string { + if x != nil { + return x.BlockNum + } + return "" +} + +type GetObjectPathResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ObjectPath *ObjectPath `protobuf:"bytes,1,opt,name=ObjectPath,proto3" json:"ObjectPath,omitempty"` + LatestWriteMarker *WriteMarker `protobuf:"bytes,2,opt,name=LatestWriteMarker,proto3" json:"LatestWriteMarker,omitempty"` +} + +func (x *GetObjectPathResponse) Reset() { + *x = GetObjectPathResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetObjectPathResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectPathResponse) ProtoMessage() {} + +func (x *GetObjectPathResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectPathResponse.ProtoReflect.Descriptor instead. +func (*GetObjectPathResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{1} +} + +func (x *GetObjectPathResponse) GetObjectPath() *ObjectPath { + if x != nil { + return x.ObjectPath + } + return nil +} + +func (x *GetObjectPathResponse) GetLatestWriteMarker() *WriteMarker { + if x != nil { + return x.LatestWriteMarker + } + return nil +} + +type ObjectPath struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RootHash string `protobuf:"bytes,1,opt,name=RootHash,proto3" json:"RootHash,omitempty"` + Meta *FileRef `protobuf:"bytes,2,opt,name=Meta,proto3" json:"Meta,omitempty"` + Path *FileRef `protobuf:"bytes,3,opt,name=Path,proto3" json:"Path,omitempty"` + FileBlockNum int64 `protobuf:"varint,4,opt,name=FileBlockNum,proto3" json:"FileBlockNum,omitempty"` +} + +func (x *ObjectPath) Reset() { + *x = ObjectPath{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ObjectPath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectPath) ProtoMessage() {} + +func (x *ObjectPath) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectPath.ProtoReflect.Descriptor instead. +func (*ObjectPath) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{2} +} + +func (x *ObjectPath) GetRootHash() string { + if x != nil { + return x.RootHash + } + return "" +} + +func (x *ObjectPath) GetMeta() *FileRef { + if x != nil { + return x.Meta + } + return nil +} + +func (x *ObjectPath) GetPath() *FileRef { + if x != nil { + return x.Path + } + return nil +} + +func (x *ObjectPath) GetFileBlockNum() int64 { + if x != nil { + return x.FileBlockNum + } + return 0 +} + +type WriteMarker struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AllocationRoot string `protobuf:"bytes,1,opt,name=AllocationRoot,proto3" json:"AllocationRoot,omitempty"` + PreviousAllocationRoot string `protobuf:"bytes,2,opt,name=PreviousAllocationRoot,proto3" json:"PreviousAllocationRoot,omitempty"` + AllocationID string `protobuf:"bytes,3,opt,name=AllocationID,proto3" json:"AllocationID,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=Size,proto3" json:"Size,omitempty"` + BlobberID string `protobuf:"bytes,5,opt,name=BlobberID,proto3" json:"BlobberID,omitempty"` + Timestamp int64 `protobuf:"varint,6,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` + ClientID string `protobuf:"bytes,7,opt,name=ClientID,proto3" json:"ClientID,omitempty"` + Signature string `protobuf:"bytes,8,opt,name=Signature,proto3" json:"Signature,omitempty"` +} + +func (x *WriteMarker) Reset() { + *x = WriteMarker{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteMarker) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteMarker) ProtoMessage() {} + +func (x *WriteMarker) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WriteMarker.ProtoReflect.Descriptor instead. +func (*WriteMarker) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{3} +} + +func (x *WriteMarker) GetAllocationRoot() string { + if x != nil { + return x.AllocationRoot + } + return "" +} + +func (x *WriteMarker) GetPreviousAllocationRoot() string { + if x != nil { + return x.PreviousAllocationRoot + } + return "" +} + +func (x *WriteMarker) GetAllocationID() string { + if x != nil { + return x.AllocationID + } + return "" +} + +func (x *WriteMarker) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *WriteMarker) GetBlobberID() string { + if x != nil { + return x.BlobberID + } + return "" +} + +func (x *WriteMarker) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *WriteMarker) GetClientID() string { + if x != nil { + return x.ClientID + } + return "" +} + +func (x *WriteMarker) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +type ListEntitiesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + AuthToken string `protobuf:"bytes,4,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Allocation string `protobuf:"bytes,5,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *ListEntitiesRequest) Reset() { + *x = ListEntitiesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEntitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEntitiesRequest) ProtoMessage() {} + +func (x *ListEntitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListEntitiesRequest.ProtoReflect.Descriptor instead. +func (*ListEntitiesRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{4} +} + +func (x *ListEntitiesRequest) GetContext() *RequestContext { + if x != nil { + return x.Context + } + return nil +} + +func (x *ListEntitiesRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ListEntitiesRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *ListEntitiesRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken + } + return "" +} + +func (x *ListEntitiesRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type ListEntitiesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AllocationRoot string `protobuf:"bytes,1,opt,name=AllocationRoot,proto3" json:"AllocationRoot,omitempty"` + MetaData *FileRef `protobuf:"bytes,2,opt,name=MetaData,proto3" json:"MetaData,omitempty"` +} + +func (x *ListEntitiesResponse) Reset() { + *x = ListEntitiesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEntitiesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEntitiesResponse) ProtoMessage() {} + +func (x *ListEntitiesResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListEntitiesResponse.ProtoReflect.Descriptor instead. +func (*ListEntitiesResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{5} +} + +func (x *ListEntitiesResponse) GetAllocationRoot() string { + if x != nil { + return x.AllocationRoot + } + return "" +} + +func (x *ListEntitiesResponse) GetMetaData() *FileRef { + if x != nil { + return x.MetaData + } + return nil +} + +type GetFileStatsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + Allocation string `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *GetFileStatsRequest) Reset() { + *x = GetFileStatsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileStatsRequest) ProtoMessage() {} + +func (x *GetFileStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFileStatsRequest.ProtoReflect.Descriptor instead. +func (*GetFileStatsRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{6} +} + +func (x *GetFileStatsRequest) GetContext() *RequestContext { + if x != nil { + return x.Context + } + return nil +} + +func (x *GetFileStatsRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *GetFileStatsRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *GetFileStatsRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type GetFileStatsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MetaData *FileRef `protobuf:"bytes,1,opt,name=MetaData,proto3" json:"MetaData,omitempty"` + Stats *FileStats `protobuf:"bytes,2,opt,name=Stats,proto3" json:"Stats,omitempty"` +} + +func (x *GetFileStatsResponse) Reset() { + *x = GetFileStatsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileStatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileStatsResponse) ProtoMessage() {} + +func (x *GetFileStatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFileStatsResponse.ProtoReflect.Descriptor instead. +func (*GetFileStatsResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{7} +} + +func (x *GetFileStatsResponse) GetMetaData() *FileRef { + if x != nil { + return x.MetaData + } + return nil +} + +func (x *GetFileStatsResponse) GetStats() *FileStats { + if x != nil { + return x.Stats + } + return nil +} + +type FileStats struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + RefID int64 `protobuf:"varint,2,opt,name=RefID,proto3" json:"RefID,omitempty"` + NumUpdates int64 `protobuf:"varint,3,opt,name=NumUpdates,proto3" json:"NumUpdates,omitempty"` + NumBlockDownloads int64 `protobuf:"varint,4,opt,name=NumBlockDownloads,proto3" json:"NumBlockDownloads,omitempty"` + SuccessChallenges int64 `protobuf:"varint,5,opt,name=SuccessChallenges,proto3" json:"SuccessChallenges,omitempty"` + FailedChallenges int64 `protobuf:"varint,6,opt,name=FailedChallenges,proto3" json:"FailedChallenges,omitempty"` + LastChallengeResponseTxn string `protobuf:"bytes,7,opt,name=LastChallengeResponseTxn,proto3" json:"LastChallengeResponseTxn,omitempty"` + WriteMarkerRedeemTxn string `protobuf:"bytes,8,opt,name=WriteMarkerRedeemTxn,proto3" json:"WriteMarkerRedeemTxn,omitempty"` + CreatedAt int64 `protobuf:"varint,9,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` + UpdatedAt int64 `protobuf:"varint,10,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` +} + +func (x *FileStats) Reset() { + *x = FileStats{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileStats) ProtoMessage() {} + +func (x *FileStats) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileStats.ProtoReflect.Descriptor instead. +func (*FileStats) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{8} +} + +func (x *FileStats) GetID() int64 { + if x != nil { + return x.ID + } + return 0 +} + +func (x *FileStats) GetRefID() int64 { + if x != nil { + return x.RefID + } + return 0 +} + +func (x *FileStats) GetNumUpdates() int64 { + if x != nil { + return x.NumUpdates + } + return 0 +} + +func (x *FileStats) GetNumBlockDownloads() int64 { + if x != nil { + return x.NumBlockDownloads + } + return 0 +} + +func (x *FileStats) GetSuccessChallenges() int64 { + if x != nil { + return x.SuccessChallenges + } + return 0 +} + +func (x *FileStats) GetFailedChallenges() int64 { + if x != nil { + return x.FailedChallenges + } + return 0 +} + +func (x *FileStats) GetLastChallengeResponseTxn() string { + if x != nil { + return x.LastChallengeResponseTxn + } + return "" +} + +func (x *FileStats) GetWriteMarkerRedeemTxn() string { + if x != nil { + return x.WriteMarkerRedeemTxn + } + return "" +} + +func (x *FileStats) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *FileStats) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +type GetFileMetaDataRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + AuthToken string `protobuf:"bytes,4,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Allocation string `protobuf:"bytes,5,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *GetFileMetaDataRequest) Reset() { + *x = GetFileMetaDataRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileMetaDataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileMetaDataRequest) ProtoMessage() {} + +func (x *GetFileMetaDataRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFileMetaDataRequest.ProtoReflect.Descriptor instead. +func (*GetFileMetaDataRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{9} +} + +func (x *GetFileMetaDataRequest) GetContext() *RequestContext { + if x != nil { + return x.Context + } + return nil +} + +func (x *GetFileMetaDataRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *GetFileMetaDataRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *GetFileMetaDataRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken + } + return "" +} + +func (x *GetFileMetaDataRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type GetFileMetaDataResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MetaData *FileRef `protobuf:"bytes,1,opt,name=MetaData,proto3" json:"MetaData,omitempty"` + Collaborators []*Collaborator `protobuf:"bytes,2,rep,name=Collaborators,proto3" json:"Collaborators,omitempty"` +} + +func (x *GetFileMetaDataResponse) Reset() { + *x = GetFileMetaDataResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileMetaDataResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileMetaDataResponse) ProtoMessage() {} + +func (x *GetFileMetaDataResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFileMetaDataResponse.ProtoReflect.Descriptor instead. +func (*GetFileMetaDataResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{10} +} + +func (x *GetFileMetaDataResponse) GetMetaData() *FileRef { + if x != nil { + return x.MetaData + } + return nil +} + +func (x *GetFileMetaDataResponse) GetCollaborators() []*Collaborator { + if x != nil { + return x.Collaborators + } + return nil +} + +type CommitMetaTxn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefId int64 `protobuf:"varint,1,opt,name=RefId,proto3" json:"RefId,omitempty"` + TxnId string `protobuf:"bytes,2,opt,name=TxnId,proto3" json:"TxnId,omitempty"` + CreatedAt int64 `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` +} + +func (x *CommitMetaTxn) Reset() { + *x = CommitMetaTxn{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommitMetaTxn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommitMetaTxn) ProtoMessage() {} + +func (x *CommitMetaTxn) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommitMetaTxn.ProtoReflect.Descriptor instead. +func (*CommitMetaTxn) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{11} +} + +func (x *CommitMetaTxn) GetRefId() int64 { + if x != nil { + return x.RefId + } + return 0 +} + +func (x *CommitMetaTxn) GetTxnId() string { + if x != nil { + return x.TxnId + } + return "" +} + +func (x *CommitMetaTxn) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type Collaborator struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefId int64 `protobuf:"varint,1,opt,name=RefId,proto3" json:"RefId,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=ClientId,proto3" json:"ClientId,omitempty"` + CreatedAt int64 `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` +} + +func (x *Collaborator) Reset() { + *x = Collaborator{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Collaborator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Collaborator) ProtoMessage() {} + +func (x *Collaborator) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Collaborator.ProtoReflect.Descriptor instead. +func (*Collaborator) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{12} +} + +func (x *Collaborator) GetRefId() int64 { + if x != nil { + return x.RefId + } + return 0 +} + +func (x *Collaborator) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *Collaborator) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type RequestContext struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Client string `protobuf:"bytes,1,opt,name=client,proto3" json:"client,omitempty"` + ClientKey string `protobuf:"bytes,2,opt,name=client_key,json=clientKey,proto3" json:"client_key,omitempty"` + Allocation string `protobuf:"bytes,3,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *RequestContext) Reset() { + *x = RequestContext{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestContext) ProtoMessage() {} + +func (x *RequestContext) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestContext.ProtoReflect.Descriptor instead. +func (*RequestContext) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{13} +} + +func (x *RequestContext) GetClient() string { + if x != nil { + return x.Client + } + return "" +} + +func (x *RequestContext) GetClientKey() string { + if x != nil { + return x.ClientKey + } + return "" +} + +func (x *RequestContext) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type GetAllocationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetAllocationRequest) Reset() { + *x = GetAllocationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllocationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllocationRequest) ProtoMessage() {} + +func (x *GetAllocationRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllocationRequest.ProtoReflect.Descriptor instead. +func (*GetAllocationRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{14} +} + +func (x *GetAllocationRequest) GetContext() *RequestContext { + if x != nil { + return x.Context + } + return nil +} + +func (x *GetAllocationRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetAllocationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allocation *Allocation `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *GetAllocationResponse) Reset() { + *x = GetAllocationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllocationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllocationResponse) ProtoMessage() {} + +func (x *GetAllocationResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllocationResponse.ProtoReflect.Descriptor instead. +func (*GetAllocationResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{15} +} + +func (x *GetAllocationResponse) GetAllocation() *Allocation { + if x != nil { + return x.Allocation + } + return nil +} + +type Allocation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Tx string `protobuf:"bytes,2,opt,name=Tx,proto3" json:"Tx,omitempty"` + TotalSize int64 `protobuf:"varint,3,opt,name=TotalSize,proto3" json:"TotalSize,omitempty"` + UsedSize int64 `protobuf:"varint,4,opt,name=UsedSize,proto3" json:"UsedSize,omitempty"` + OwnerID string `protobuf:"bytes,5,opt,name=OwnerID,proto3" json:"OwnerID,omitempty"` + OwnerPublicKey string `protobuf:"bytes,6,opt,name=OwnerPublicKey,proto3" json:"OwnerPublicKey,omitempty"` + Expiration int64 `protobuf:"varint,7,opt,name=Expiration,proto3" json:"Expiration,omitempty"` + AllocationRoot string `protobuf:"bytes,8,opt,name=AllocationRoot,proto3" json:"AllocationRoot,omitempty"` + BlobberSize int64 `protobuf:"varint,9,opt,name=BlobberSize,proto3" json:"BlobberSize,omitempty"` + BlobberSizeUsed int64 `protobuf:"varint,10,opt,name=BlobberSizeUsed,proto3" json:"BlobberSizeUsed,omitempty"` + LatestRedeemedWM string `protobuf:"bytes,11,opt,name=LatestRedeemedWM,proto3" json:"LatestRedeemedWM,omitempty"` + IsRedeemRequired bool `protobuf:"varint,12,opt,name=IsRedeemRequired,proto3" json:"IsRedeemRequired,omitempty"` + TimeUnit int64 `protobuf:"varint,13,opt,name=TimeUnit,proto3" json:"TimeUnit,omitempty"` + CleanedUp bool `protobuf:"varint,14,opt,name=CleanedUp,proto3" json:"CleanedUp,omitempty"` + Finalized bool `protobuf:"varint,15,opt,name=Finalized,proto3" json:"Finalized,omitempty"` + Terms []*Term `protobuf:"bytes,16,rep,name=Terms,proto3" json:"Terms,omitempty"` + PayerID string `protobuf:"bytes,17,opt,name=PayerID,proto3" json:"PayerID,omitempty"` +} + +func (x *Allocation) Reset() { + *x = Allocation{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Allocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Allocation) ProtoMessage() {} + +func (x *Allocation) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Allocation.ProtoReflect.Descriptor instead. +func (*Allocation) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{16} +} + +func (x *Allocation) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *Allocation) GetTx() string { + if x != nil { + return x.Tx + } + return "" +} + +func (x *Allocation) GetTotalSize() int64 { + if x != nil { + return x.TotalSize + } + return 0 +} + +func (x *Allocation) GetUsedSize() int64 { + if x != nil { + return x.UsedSize + } + return 0 +} + +func (x *Allocation) GetOwnerID() string { + if x != nil { + return x.OwnerID + } + return "" +} + +func (x *Allocation) GetOwnerPublicKey() string { + if x != nil { + return x.OwnerPublicKey + } + return "" +} + +func (x *Allocation) GetExpiration() int64 { + if x != nil { + return x.Expiration + } + return 0 +} + +func (x *Allocation) GetAllocationRoot() string { + if x != nil { + return x.AllocationRoot + } + return "" +} + +func (x *Allocation) GetBlobberSize() int64 { + if x != nil { + return x.BlobberSize + } + return 0 +} + +func (x *Allocation) GetBlobberSizeUsed() int64 { + if x != nil { + return x.BlobberSizeUsed + } + return 0 +} + +func (x *Allocation) GetLatestRedeemedWM() string { + if x != nil { + return x.LatestRedeemedWM + } + return "" +} + +func (x *Allocation) GetIsRedeemRequired() bool { + if x != nil { + return x.IsRedeemRequired + } + return false +} + +func (x *Allocation) GetTimeUnit() int64 { + if x != nil { + return x.TimeUnit + } + return 0 +} + +func (x *Allocation) GetCleanedUp() bool { + if x != nil { + return x.CleanedUp + } + return false +} + +func (x *Allocation) GetFinalized() bool { + if x != nil { + return x.Finalized + } + return false +} + +func (x *Allocation) GetTerms() []*Term { + if x != nil { + return x.Terms + } + return nil +} + +func (x *Allocation) GetPayerID() string { + if x != nil { + return x.PayerID + } + return "" +} + +type Term struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + BlobberID string `protobuf:"bytes,2,opt,name=BlobberID,proto3" json:"BlobberID,omitempty"` + AllocationID string `protobuf:"bytes,3,opt,name=AllocationID,proto3" json:"AllocationID,omitempty"` + ReadPrice int64 `protobuf:"varint,4,opt,name=ReadPrice,proto3" json:"ReadPrice,omitempty"` + WritePrice int64 `protobuf:"varint,5,opt,name=WritePrice,proto3" json:"WritePrice,omitempty"` +} + +func (x *Term) Reset() { + *x = Term{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Term) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Term) ProtoMessage() {} + +func (x *Term) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Term.ProtoReflect.Descriptor instead. +func (*Term) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{17} +} + +func (x *Term) GetID() int64 { + if x != nil { + return x.ID + } + return 0 +} + +func (x *Term) GetBlobberID() string { + if x != nil { + return x.BlobberID + } + return "" +} + +func (x *Term) GetAllocationID() string { + if x != nil { + return x.AllocationID + } + return "" +} + +func (x *Term) GetReadPrice() int64 { + if x != nil { + return x.ReadPrice + } + return 0 +} + +func (x *Term) GetWritePrice() int64 { + if x != nil { + return x.WritePrice + } + return 0 +} + +type FileRef struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` + FileMetaData *FileMetaData `protobuf:"bytes,2,opt,name=FileMetaData,proto3" json:"FileMetaData,omitempty"` + DirMetaData *DirMetaData `protobuf:"bytes,3,opt,name=DirMetaData,proto3" json:"DirMetaData,omitempty"` +} + +func (x *FileRef) Reset() { + *x = FileRef{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileRef) ProtoMessage() {} + +func (x *FileRef) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileRef.ProtoReflect.Descriptor instead. +func (*FileRef) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{18} +} + +func (x *FileRef) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *FileRef) GetFileMetaData() *FileMetaData { + if x != nil { + return x.FileMetaData + } + return nil +} + +func (x *FileRef) GetDirMetaData() *DirMetaData { + if x != nil { + return x.DirMetaData + } + return nil +} + +type FileMetaData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` + LookupHash string `protobuf:"bytes,2,opt,name=LookupHash,proto3" json:"LookupHash,omitempty"` + Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"` + Path string `protobuf:"bytes,4,opt,name=Path,proto3" json:"Path,omitempty"` + Hash string `protobuf:"bytes,5,opt,name=Hash,proto3" json:"Hash,omitempty"` + NumBlocks int64 `protobuf:"varint,6,opt,name=NumBlocks,proto3" json:"NumBlocks,omitempty"` + PathHash string `protobuf:"bytes,7,opt,name=PathHash,proto3" json:"PathHash,omitempty"` + CustomMeta string `protobuf:"bytes,8,opt,name=CustomMeta,proto3" json:"CustomMeta,omitempty"` + ContentHash string `protobuf:"bytes,9,opt,name=ContentHash,proto3" json:"ContentHash,omitempty"` + Size int64 `protobuf:"varint,10,opt,name=Size,proto3" json:"Size,omitempty"` + MerkleRoot string `protobuf:"bytes,11,opt,name=MerkleRoot,proto3" json:"MerkleRoot,omitempty"` + ActualFileSize int64 `protobuf:"varint,12,opt,name=ActualFileSize,proto3" json:"ActualFileSize,omitempty"` + ActualFileHash string `protobuf:"bytes,13,opt,name=ActualFileHash,proto3" json:"ActualFileHash,omitempty"` + MimeType string `protobuf:"bytes,14,opt,name=MimeType,proto3" json:"MimeType,omitempty"` + ThumbnailSize int64 `protobuf:"varint,15,opt,name=ThumbnailSize,proto3" json:"ThumbnailSize,omitempty"` + ThumbnailHash string `protobuf:"bytes,16,opt,name=ThumbnailHash,proto3" json:"ThumbnailHash,omitempty"` + ActualThumbnailSize int64 `protobuf:"varint,17,opt,name=ActualThumbnailSize,proto3" json:"ActualThumbnailSize,omitempty"` + ActualThumbnailHash string `protobuf:"bytes,18,opt,name=ActualThumbnailHash,proto3" json:"ActualThumbnailHash,omitempty"` + EncryptedKey string `protobuf:"bytes,19,opt,name=EncryptedKey,proto3" json:"EncryptedKey,omitempty"` + Attributes []byte `protobuf:"bytes,20,opt,name=Attributes,proto3" json:"Attributes,omitempty"` + OnCloud bool `protobuf:"varint,21,opt,name=OnCloud,proto3" json:"OnCloud,omitempty"` + CommitMetaTxns []*CommitMetaTxn `protobuf:"bytes,22,rep,name=CommitMetaTxns,proto3" json:"CommitMetaTxns,omitempty"` + CreatedAt int64 `protobuf:"varint,23,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` + UpdatedAt int64 `protobuf:"varint,24,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` +} + +func (x *FileMetaData) Reset() { + *x = FileMetaData{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileMetaData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileMetaData) ProtoMessage() {} + +func (x *FileMetaData) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileMetaData.ProtoReflect.Descriptor instead. +func (*FileMetaData) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{19} +} + +func (x *FileMetaData) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *FileMetaData) GetLookupHash() string { + if x != nil { + return x.LookupHash + } + return "" +} + +func (x *FileMetaData) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FileMetaData) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *FileMetaData) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *FileMetaData) GetNumBlocks() int64 { + if x != nil { + return x.NumBlocks + } + return 0 +} + +func (x *FileMetaData) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *FileMetaData) GetCustomMeta() string { + if x != nil { + return x.CustomMeta + } + return "" +} + +func (x *FileMetaData) GetContentHash() string { + if x != nil { + return x.ContentHash + } + return "" +} + +func (x *FileMetaData) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *FileMetaData) GetMerkleRoot() string { + if x != nil { + return x.MerkleRoot + } + return "" +} + +func (x *FileMetaData) GetActualFileSize() int64 { + if x != nil { + return x.ActualFileSize + } + return 0 +} + +func (x *FileMetaData) GetActualFileHash() string { + if x != nil { + return x.ActualFileHash + } + return "" +} + +func (x *FileMetaData) GetMimeType() string { + if x != nil { + return x.MimeType + } + return "" +} + +func (x *FileMetaData) GetThumbnailSize() int64 { + if x != nil { + return x.ThumbnailSize + } + return 0 +} + +func (x *FileMetaData) GetThumbnailHash() string { + if x != nil { + return x.ThumbnailHash + } + return "" +} + +func (x *FileMetaData) GetActualThumbnailSize() int64 { + if x != nil { + return x.ActualThumbnailSize + } + return 0 +} + +func (x *FileMetaData) GetActualThumbnailHash() string { + if x != nil { + return x.ActualThumbnailHash + } + return "" +} + +func (x *FileMetaData) GetEncryptedKey() string { + if x != nil { + return x.EncryptedKey + } + return "" +} + +func (x *FileMetaData) GetAttributes() []byte { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *FileMetaData) GetOnCloud() bool { + if x != nil { + return x.OnCloud + } + return false +} + +func (x *FileMetaData) GetCommitMetaTxns() []*CommitMetaTxn { + if x != nil { + return x.CommitMetaTxns + } + return nil +} + +func (x *FileMetaData) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *FileMetaData) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +type DirMetaData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` + LookupHash string `protobuf:"bytes,2,opt,name=LookupHash,proto3" json:"LookupHash,omitempty"` + Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"` + Path string `protobuf:"bytes,4,opt,name=Path,proto3" json:"Path,omitempty"` + Hash string `protobuf:"bytes,5,opt,name=Hash,proto3" json:"Hash,omitempty"` + NumBlocks int64 `protobuf:"varint,6,opt,name=NumBlocks,proto3" json:"NumBlocks,omitempty"` + PathHash string `protobuf:"bytes,7,opt,name=PathHash,proto3" json:"PathHash,omitempty"` + Size int64 `protobuf:"varint,8,opt,name=Size,proto3" json:"Size,omitempty"` + CreatedAt int64 `protobuf:"varint,9,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` + UpdatedAt int64 `protobuf:"varint,10,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` + Children []*FileRef `protobuf:"bytes,11,rep,name=Children,proto3" json:"Children,omitempty"` +} + +func (x *DirMetaData) Reset() { + *x = DirMetaData{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DirMetaData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DirMetaData) ProtoMessage() {} + +func (x *DirMetaData) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DirMetaData.ProtoReflect.Descriptor instead. +func (*DirMetaData) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{20} +} + +func (x *DirMetaData) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *DirMetaData) GetLookupHash() string { + if x != nil { + return x.LookupHash + } + return "" +} + +func (x *DirMetaData) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DirMetaData) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *DirMetaData) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *DirMetaData) GetNumBlocks() int64 { + if x != nil { + return x.NumBlocks + } + return 0 +} + +func (x *DirMetaData) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *DirMetaData) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *DirMetaData) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *DirMetaData) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *DirMetaData) GetChildren() []*FileRef { + if x != nil { + return x.Children + } + return nil +} + +var File_blobber_proto protoreflect.FileDescriptor + +var file_blobber_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xa4, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, + 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x22, 0xa6, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, + 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x11, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x11, + 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x72, 0x22, 0xae, 0x01, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, + 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x52, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2f, 0x0a, 0x04, + 0x4d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x2f, 0x0a, + 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x22, + 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x22, 0x9b, 0x02, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x36, 0x0a, 0x16, 0x50, 0x72, + 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x50, 0x72, 0x65, 0x76, + 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, + 0x6f, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x42, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0xc3, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, + 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, + 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, + 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, + 0x0a, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x22, + 0xa4, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, + 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, + 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x37, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, + 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x22, 0x85, 0x03, + 0x0a, 0x09, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x49, + 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x52, + 0x65, 0x66, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x52, 0x65, 0x66, 0x49, + 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x4e, 0x75, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x4e, 0x75, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x6f, 0x77, + 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x4e, 0x75, + 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, + 0x2c, 0x0a, 0x11, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, + 0x6e, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x53, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x2a, 0x0a, + 0x10, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x43, + 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x18, 0x4c, 0x61, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x54, 0x78, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x4c, 0x61, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x54, 0x78, 0x6e, 0x12, 0x32, 0x0a, 0x14, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x54, 0x78, 0x6e, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x14, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, + 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x54, 0x78, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9a, + 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x4d, 0x65, + 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, + 0x61, 0x74, 0x61, 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, + 0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0d, 0x43, 0x6f, + 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x59, 0x0a, 0x0d, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x12, 0x14, 0x0a, 0x05, + 0x52, 0x65, 0x66, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x52, 0x65, 0x66, + 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x78, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x54, 0x78, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x5e, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, + 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x52, 0x65, 0x66, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x52, 0x65, 0x66, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x67, 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, + 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x64, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x57, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, + 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb6, + 0x04, 0x0a, 0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x0e, 0x0a, + 0x02, 0x54, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x54, 0x78, 0x12, 0x1c, 0x0a, + 0x09, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, + 0x73, 0x65, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, + 0x73, 0x65, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, + 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x45, 0x78, 0x70, + 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x45, + 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, + 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, + 0x69, 0x7a, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, + 0x7a, 0x65, 0x55, 0x73, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x42, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x55, 0x73, 0x65, 0x64, 0x12, 0x2a, 0x0a, + 0x10, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x65, 0x64, 0x57, + 0x4d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x64, 0x65, 0x65, 0x6d, 0x65, 0x64, 0x57, 0x4d, 0x12, 0x2a, 0x0a, 0x10, 0x49, 0x73, 0x52, + 0x65, 0x64, 0x65, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x10, 0x49, 0x73, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x52, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, + 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, + 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x65, 0x64, 0x55, 0x70, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x65, 0x64, 0x55, 0x70, 0x12, + 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x09, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x2e, 0x0a, + 0x05, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x52, 0x05, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x18, 0x0a, + 0x07, 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x22, 0x96, 0x01, 0x0a, 0x04, 0x54, 0x65, 0x72, 0x6d, + 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, + 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, 0x12, 0x22, + 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x61, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x52, 0x65, 0x61, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x57, 0x72, 0x69, 0x74, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x57, 0x72, 0x69, 0x74, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x22, 0xa6, 0x01, 0x0a, 0x07, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, 0x12, 0x0a, 0x04, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x44, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x0b, 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, + 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x44, 0x69, + 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x22, 0xaf, 0x06, 0x0a, 0x0c, 0x46, 0x69, + 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, + 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x4e, 0x75, + 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4e, + 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, + 0x48, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x74, 0x68, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, + 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x4d, 0x65, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, + 0x61, 0x73, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, + 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x4d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x63, + 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, + 0x48, 0x61, 0x73, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x41, 0x63, 0x74, 0x75, + 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x69, + 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x69, + 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, + 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x54, + 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, 0x0d, + 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x18, 0x10, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x30, 0x0a, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, 0x75, 0x6d, + 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, + 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x18, 0x12, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, + 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x45, 0x6e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x6e, + 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x4f, 0x6e, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x12, 0x49, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, + 0x74, 0x61, 0x54, 0x78, 0x6e, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, + 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x73, 0x12, + 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x17, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x18, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xc0, 0x02, 0x0a, 0x0b, + 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1e, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x4e, + 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x74, + 0x68, 0x48, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x74, + 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, + 0x6e, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x32, 0xba, + 0x05, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x8e, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, + 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, + 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, + 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x7b, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x86, 0x01, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x7d, 0x12, 0x85, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, + 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2f, 0x7b, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x28, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, + 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_blobber_proto_rawDescOnce sync.Once + file_blobber_proto_rawDescData = file_blobber_proto_rawDesc +) + +func file_blobber_proto_rawDescGZIP() []byte { + file_blobber_proto_rawDescOnce.Do(func() { + file_blobber_proto_rawDescData = protoimpl.X.CompressGZIP(file_blobber_proto_rawDescData) + }) + return file_blobber_proto_rawDescData +} + +var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_blobber_proto_goTypes = []interface{}{ + (*GetObjectPathRequest)(nil), // 0: blobber.service.v1.GetObjectPathRequest + (*GetObjectPathResponse)(nil), // 1: blobber.service.v1.GetObjectPathResponse + (*ObjectPath)(nil), // 2: blobber.service.v1.ObjectPath + (*WriteMarker)(nil), // 3: blobber.service.v1.WriteMarker + (*ListEntitiesRequest)(nil), // 4: blobber.service.v1.ListEntitiesRequest + (*ListEntitiesResponse)(nil), // 5: blobber.service.v1.ListEntitiesResponse + (*GetFileStatsRequest)(nil), // 6: blobber.service.v1.GetFileStatsRequest + (*GetFileStatsResponse)(nil), // 7: blobber.service.v1.GetFileStatsResponse + (*FileStats)(nil), // 8: blobber.service.v1.FileStats + (*GetFileMetaDataRequest)(nil), // 9: blobber.service.v1.GetFileMetaDataRequest + (*GetFileMetaDataResponse)(nil), // 10: blobber.service.v1.GetFileMetaDataResponse + (*CommitMetaTxn)(nil), // 11: blobber.service.v1.CommitMetaTxn + (*Collaborator)(nil), // 12: blobber.service.v1.Collaborator + (*RequestContext)(nil), // 13: blobber.service.v1.RequestContext + (*GetAllocationRequest)(nil), // 14: blobber.service.v1.GetAllocationRequest + (*GetAllocationResponse)(nil), // 15: blobber.service.v1.GetAllocationResponse + (*Allocation)(nil), // 16: blobber.service.v1.Allocation + (*Term)(nil), // 17: blobber.service.v1.Term + (*FileRef)(nil), // 18: blobber.service.v1.FileRef + (*FileMetaData)(nil), // 19: blobber.service.v1.FileMetaData + (*DirMetaData)(nil), // 20: blobber.service.v1.DirMetaData +} +var file_blobber_proto_depIdxs = []int32{ + 13, // 0: blobber.service.v1.GetObjectPathRequest.context:type_name -> blobber.service.v1.RequestContext + 2, // 1: blobber.service.v1.GetObjectPathResponse.ObjectPath:type_name -> blobber.service.v1.ObjectPath + 3, // 2: blobber.service.v1.GetObjectPathResponse.LatestWriteMarker:type_name -> blobber.service.v1.WriteMarker + 18, // 3: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef + 18, // 4: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef + 13, // 5: blobber.service.v1.ListEntitiesRequest.context:type_name -> blobber.service.v1.RequestContext + 18, // 6: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef + 13, // 7: blobber.service.v1.GetFileStatsRequest.context:type_name -> blobber.service.v1.RequestContext + 18, // 8: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef + 8, // 9: blobber.service.v1.GetFileStatsResponse.Stats:type_name -> blobber.service.v1.FileStats + 13, // 10: blobber.service.v1.GetFileMetaDataRequest.context:type_name -> blobber.service.v1.RequestContext + 18, // 11: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef + 12, // 12: blobber.service.v1.GetFileMetaDataResponse.Collaborators:type_name -> blobber.service.v1.Collaborator + 13, // 13: blobber.service.v1.GetAllocationRequest.context:type_name -> blobber.service.v1.RequestContext + 16, // 14: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation + 17, // 15: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term + 19, // 16: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData + 20, // 17: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData + 11, // 18: blobber.service.v1.FileMetaData.CommitMetaTxns:type_name -> blobber.service.v1.CommitMetaTxn + 18, // 19: blobber.service.v1.DirMetaData.Children:type_name -> blobber.service.v1.FileRef + 14, // 20: blobber.service.v1.Blobber.GetAllocation:input_type -> blobber.service.v1.GetAllocationRequest + 9, // 21: blobber.service.v1.Blobber.GetFileMetaData:input_type -> blobber.service.v1.GetFileMetaDataRequest + 6, // 22: blobber.service.v1.Blobber.GetFileStats:input_type -> blobber.service.v1.GetFileStatsRequest + 4, // 23: blobber.service.v1.Blobber.ListEntities:input_type -> blobber.service.v1.ListEntitiesRequest + 0, // 24: blobber.service.v1.Blobber.GetObjectPath:input_type -> blobber.service.v1.GetObjectPathRequest + 15, // 25: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse + 10, // 26: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse + 7, // 27: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse + 5, // 28: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse + 1, // 29: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse + 25, // [25:30] is the sub-list for method output_type + 20, // [20:25] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_blobber_proto_init() } +func file_blobber_proto_init() { + if File_blobber_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_blobber_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetObjectPathRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetObjectPathResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObjectPath); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteMarker); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEntitiesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEntitiesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFileStatsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFileStatsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileStats); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFileMetaDataRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFileMetaDataResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommitMetaTxn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Collaborator); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestContext); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllocationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllocationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Allocation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Term); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileRef); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileMetaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DirMetaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_blobber_proto_rawDesc, + NumEnums: 0, + NumMessages: 21, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_blobber_proto_goTypes, + DependencyIndexes: file_blobber_proto_depIdxs, + MessageInfos: file_blobber_proto_msgTypes, + }.Build() + File_blobber_proto = out.File + file_blobber_proto_rawDesc = nil + file_blobber_proto_goTypes = nil + file_blobber_proto_depIdxs = nil +} diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go new file mode 100644 index 000000000..1dc9ef977 --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go @@ -0,0 +1,647 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: blobber.proto + +/* +Package blobbergrpc is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package blobbergrpc + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Blobber_GetAllocation_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Blobber_GetAllocation_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllocationRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetAllocation_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetAllocation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_GetAllocation_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllocationRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetAllocation_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetAllocation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Blobber_GetFileMetaData_0 = &utilities.DoubleArray{Encoding: map[string]int{"allocation": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Blobber_GetFileMetaData_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetFileMetaDataRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileMetaData_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetFileMetaData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_GetFileMetaData_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetFileMetaDataRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileMetaData_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetFileMetaData(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Blobber_GetFileStats_0 = &utilities.DoubleArray{Encoding: map[string]int{"allocation": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Blobber_GetFileStats_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetFileStatsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileStats_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetFileStats(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_GetFileStats_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetFileStatsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileStats_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetFileStats(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Blobber_ListEntities_0 = &utilities.DoubleArray{Encoding: map[string]int{"allocation": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Blobber_ListEntities_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListEntitiesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_ListEntities_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListEntities(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_ListEntities_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListEntitiesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_ListEntities_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListEntities(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Blobber_GetObjectPath_0 = &utilities.DoubleArray{Encoding: map[string]int{"allocation": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Blobber_GetObjectPath_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetObjectPathRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetObjectPath_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetObjectPath(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_GetObjectPath_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetObjectPathRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetObjectPath_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetObjectPath(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterBlobberHandlerServer registers the http handlers for service Blobber to "mux". +// UnaryRPC :call BlobberServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBlobberHandlerFromEndpoint instead. +func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BlobberServer) error { + + mux.Handle("GET", pattern_Blobber_GetAllocation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetAllocation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetAllocation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetFileMetaData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetFileMetaData_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetFileMetaData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetFileStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetFileStats_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetFileStats_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_ListEntities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_ListEntities_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_ListEntities_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetObjectPath_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetObjectPath_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetObjectPath_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterBlobberHandlerFromEndpoint is same as RegisterBlobberHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterBlobberHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterBlobberHandler(ctx, mux, conn) +} + +// RegisterBlobberHandler registers the http handlers for service Blobber to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterBlobberHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterBlobberHandlerClient(ctx, mux, NewBlobberClient(conn)) +} + +// RegisterBlobberHandlerClient registers the http handlers for service Blobber +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BlobberClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BlobberClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "BlobberClient" to call the correct interceptors. +func RegisterBlobberHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BlobberClient) error { + + mux.Handle("GET", pattern_Blobber_GetAllocation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_GetAllocation_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetAllocation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetFileMetaData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_GetFileMetaData_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetFileMetaData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetFileStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_GetFileStats_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetFileStats_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_ListEntities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_ListEntities_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_ListEntities_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetObjectPath_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_GetObjectPath_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetObjectPath_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Blobber_GetAllocation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "allocation"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Blobber_GetFileMetaData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "meta", "allocation"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Blobber_GetFileStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "stats", "allocation"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Blobber_ListEntities_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "list", "allocation"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Blobber_GetObjectPath_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "objectpath", "allocation"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Blobber_GetAllocation_0 = runtime.ForwardResponseMessage + + forward_Blobber_GetFileMetaData_0 = runtime.ForwardResponseMessage + + forward_Blobber_GetFileStats_0 = runtime.ForwardResponseMessage + + forward_Blobber_ListEntities_0 = runtime.ForwardResponseMessage + + forward_Blobber_GetObjectPath_0 = runtime.ForwardResponseMessage +) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go new file mode 100644 index 000000000..0d6afa8ea --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go @@ -0,0 +1,245 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package blobbergrpc + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// BlobberClient is the client API for Blobber service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type BlobberClient interface { + GetAllocation(ctx context.Context, in *GetAllocationRequest, opts ...grpc.CallOption) (*GetAllocationResponse, error) + GetFileMetaData(ctx context.Context, in *GetFileMetaDataRequest, opts ...grpc.CallOption) (*GetFileMetaDataResponse, error) + GetFileStats(ctx context.Context, in *GetFileStatsRequest, opts ...grpc.CallOption) (*GetFileStatsResponse, error) + ListEntities(ctx context.Context, in *ListEntitiesRequest, opts ...grpc.CallOption) (*ListEntitiesResponse, error) + GetObjectPath(ctx context.Context, in *GetObjectPathRequest, opts ...grpc.CallOption) (*GetObjectPathResponse, error) +} + +type blobberClient struct { + cc grpc.ClientConnInterface +} + +func NewBlobberClient(cc grpc.ClientConnInterface) BlobberClient { + return &blobberClient{cc} +} + +func (c *blobberClient) GetAllocation(ctx context.Context, in *GetAllocationRequest, opts ...grpc.CallOption) (*GetAllocationResponse, error) { + out := new(GetAllocationResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/GetAllocation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) GetFileMetaData(ctx context.Context, in *GetFileMetaDataRequest, opts ...grpc.CallOption) (*GetFileMetaDataResponse, error) { + out := new(GetFileMetaDataResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/GetFileMetaData", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) GetFileStats(ctx context.Context, in *GetFileStatsRequest, opts ...grpc.CallOption) (*GetFileStatsResponse, error) { + out := new(GetFileStatsResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/GetFileStats", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) ListEntities(ctx context.Context, in *ListEntitiesRequest, opts ...grpc.CallOption) (*ListEntitiesResponse, error) { + out := new(ListEntitiesResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/ListEntities", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) GetObjectPath(ctx context.Context, in *GetObjectPathRequest, opts ...grpc.CallOption) (*GetObjectPathResponse, error) { + out := new(GetObjectPathResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/GetObjectPath", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BlobberServer is the server API for Blobber service. +// All implementations must embed UnimplementedBlobberServer +// for forward compatibility +type BlobberServer interface { + GetAllocation(context.Context, *GetAllocationRequest) (*GetAllocationResponse, error) + GetFileMetaData(context.Context, *GetFileMetaDataRequest) (*GetFileMetaDataResponse, error) + GetFileStats(context.Context, *GetFileStatsRequest) (*GetFileStatsResponse, error) + ListEntities(context.Context, *ListEntitiesRequest) (*ListEntitiesResponse, error) + GetObjectPath(context.Context, *GetObjectPathRequest) (*GetObjectPathResponse, error) + mustEmbedUnimplementedBlobberServer() +} + +// UnimplementedBlobberServer must be embedded to have forward compatible implementations. +type UnimplementedBlobberServer struct { +} + +func (UnimplementedBlobberServer) GetAllocation(context.Context, *GetAllocationRequest) (*GetAllocationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllocation not implemented") +} +func (UnimplementedBlobberServer) GetFileMetaData(context.Context, *GetFileMetaDataRequest) (*GetFileMetaDataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFileMetaData not implemented") +} +func (UnimplementedBlobberServer) GetFileStats(context.Context, *GetFileStatsRequest) (*GetFileStatsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFileStats not implemented") +} +func (UnimplementedBlobberServer) ListEntities(context.Context, *ListEntitiesRequest) (*ListEntitiesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEntities not implemented") +} +func (UnimplementedBlobberServer) GetObjectPath(context.Context, *GetObjectPathRequest) (*GetObjectPathResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetObjectPath not implemented") +} +func (UnimplementedBlobberServer) mustEmbedUnimplementedBlobberServer() {} + +// UnsafeBlobberServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BlobberServer will +// result in compilation errors. +type UnsafeBlobberServer interface { + mustEmbedUnimplementedBlobberServer() +} + +func RegisterBlobberServer(s grpc.ServiceRegistrar, srv BlobberServer) { + s.RegisterService(&Blobber_ServiceDesc, srv) +} + +func _Blobber_GetAllocation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllocationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).GetAllocation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/GetAllocation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).GetAllocation(ctx, req.(*GetAllocationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_GetFileMetaData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFileMetaDataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).GetFileMetaData(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/GetFileMetaData", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).GetFileMetaData(ctx, req.(*GetFileMetaDataRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_GetFileStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFileStatsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).GetFileStats(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/GetFileStats", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).GetFileStats(ctx, req.(*GetFileStatsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_ListEntities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEntitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).ListEntities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/ListEntities", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).ListEntities(ctx, req.(*ListEntitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_GetObjectPath_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetObjectPathRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).GetObjectPath(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/GetObjectPath", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).GetObjectPath(ctx, req.(*GetObjectPathRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Blobber_ServiceDesc is the grpc.ServiceDesc for Blobber service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Blobber_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "blobber.service.v1.Blobber", + HandlerType: (*BlobberServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAllocation", + Handler: _Blobber_GetAllocation_Handler, + }, + { + MethodName: "GetFileMetaData", + Handler: _Blobber_GetFileMetaData_Handler, + }, + { + MethodName: "GetFileStats", + Handler: _Blobber_GetFileStats_Handler, + }, + { + MethodName: "ListEntities", + Handler: _Blobber_ListEntities_Handler, + }, + { + MethodName: "GetObjectPath", + Handler: _Blobber_GetObjectPath_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "blobber.proto", +} diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto new file mode 100644 index 000000000..bc77b8d2f --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto @@ -0,0 +1,216 @@ +syntax = "proto3"; +package blobber.service.v1; + +option go_package = "./blobbergrpc"; + +import "google/api/annotations.proto"; + + +service Blobber { + rpc GetAllocation(GetAllocationRequest) returns (GetAllocationResponse) { + option (google.api.http) = { + get: "/v2/allocation" + }; + } + rpc GetFileMetaData(GetFileMetaDataRequest) returns (GetFileMetaDataResponse) { + option (google.api.http) = { + get: "/v2/file/meta/{allocation}" + }; + } + rpc GetFileStats(GetFileStatsRequest) returns (GetFileStatsResponse) { + option (google.api.http) = { + get: "/v2/file/stats/{allocation}" + }; + } + rpc ListEntities(ListEntitiesRequest) returns (ListEntitiesResponse) { + option (google.api.http) = { + get: "/v2/file/list/{allocation}" + }; + } + rpc GetObjectPath(GetObjectPathRequest) returns (GetObjectPathResponse) { + option (google.api.http) = { + get: "/v2/file/objectpath/{allocation}" + }; + } +} +message GetObjectPathRequest { + RequestContext context = 1; + string allocation = 2; + string Path = 3; + string BlockNum = 4; +} +message GetObjectPathResponse { + ObjectPath ObjectPath = 1; + WriteMarker LatestWriteMarker = 2; +} + +message ObjectPath { + string RootHash = 1; + FileRef Meta = 2; + FileRef Path = 3; + int64 FileBlockNum = 4; +} + +message WriteMarker { + string AllocationRoot = 1; + string PreviousAllocationRoot = 2; + string AllocationID = 3; + int64 Size = 4; + string BlobberID = 5; + int64 Timestamp = 6; + string ClientID = 7; + string Signature = 8; +} + +message ListEntitiesRequest { + RequestContext context = 1; + string path = 2; + string path_hash = 3; + string auth_token = 4; + string allocation = 5; +} + +message ListEntitiesResponse { + string AllocationRoot = 1; + FileRef MetaData = 2; +} + +message GetFileStatsRequest { + RequestContext context = 1; + string path = 2; + string path_hash = 3; + string allocation = 4; +} + +message GetFileStatsResponse { + FileRef MetaData = 1; + FileStats Stats = 2; +} + +message FileStats { + int64 ID = 1; + int64 RefID = 2; + int64 NumUpdates = 3; + int64 NumBlockDownloads = 4; + int64 SuccessChallenges = 5; + int64 FailedChallenges = 6; + string LastChallengeResponseTxn = 7; + string WriteMarkerRedeemTxn = 8; + int64 CreatedAt = 9; + int64 UpdatedAt = 10; +} + +message GetFileMetaDataRequest { + RequestContext context = 1; + string path = 2; + string path_hash = 3; + string auth_token = 4; + string allocation = 5; +} + +message GetFileMetaDataResponse { + FileRef MetaData = 1; + repeated Collaborator Collaborators = 2; +} + +message CommitMetaTxn { + int64 RefId = 1; + string TxnId = 2; + int64 CreatedAt = 3; +} + +message Collaborator { + int64 RefId = 1; + string ClientId = 2; + int64 CreatedAt = 3; +} + +message RequestContext { + string client = 1; + string client_key = 2; + string allocation = 3; +} + +message GetAllocationRequest { + RequestContext context = 1; + string id = 2; +} + +message GetAllocationResponse { + Allocation allocation = 1; +} + +message Allocation { + string ID = 1; + string Tx = 2; + int64 TotalSize = 3; + int64 UsedSize = 4; + string OwnerID = 5; + string OwnerPublicKey = 6; + int64 Expiration = 7; + string AllocationRoot = 8; + int64 BlobberSize = 9; + int64 BlobberSizeUsed = 10; + string LatestRedeemedWM = 11; + bool IsRedeemRequired = 12; + int64 TimeUnit = 13; + bool CleanedUp = 14; + bool Finalized = 15; + repeated Term Terms = 16; + string PayerID = 17; +} + +message Term { + int64 ID = 1; + string BlobberID = 2; + string AllocationID = 3; + int64 ReadPrice = 4; + int64 WritePrice = 5; +} + +message FileRef { + string Type = 1; + FileMetaData FileMetaData = 2; + DirMetaData DirMetaData = 3; +} + +message FileMetaData { + string Type = 1; + string LookupHash = 2; + string Name = 3; + string Path = 4; + string Hash = 5; + int64 NumBlocks = 6; + string PathHash = 7; + string CustomMeta = 8; + string ContentHash = 9; + int64 Size = 10; + string MerkleRoot = 11; + int64 ActualFileSize = 12; + string ActualFileHash = 13; + string MimeType = 14; + int64 ThumbnailSize = 15; + string ThumbnailHash = 16; + int64 ActualThumbnailSize = 17; + string ActualThumbnailHash = 18; + string EncryptedKey = 19; + bytes Attributes = 20; + bool OnCloud = 21; + repeated CommitMetaTxn CommitMetaTxns = 22; + int64 CreatedAt = 23; + int64 UpdatedAt = 24; +} + +message DirMetaData { + string Type = 1; + string LookupHash = 2; + string Name = 3; + string Path = 4; + string Hash = 5; + int64 NumBlocks = 6; + string PathHash = 7; + int64 Size = 8; + int64 CreatedAt = 9; + int64 UpdatedAt = 10; + repeated FileRef Children = 11; +} \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/annotations.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/annotations.proto new file mode 100644 index 000000000..18dcf2099 --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2015, Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/http.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/http.proto new file mode 100644 index 000000000..9d0a1e50e --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/http.proto @@ -0,0 +1,375 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; + + // When set to true, URL path parameters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; +} + +// # gRPC Transcoding +// +// gRPC Transcoding is a feature for mapping between a gRPC method and one or +// more HTTP REST endpoints. It allows developers to build a single API service +// that supports both gRPC APIs and REST APIs. Many systems, including [Google +// APIs](https://github.com/googleapis/googleapis), +// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC +// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), +// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature +// and use it for large scale production services. +// +// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +// how different portions of the gRPC request message are mapped to the URL +// path, URL query parameters, and HTTP request body. It also controls how the +// gRPC response message is mapped to the HTTP response body. `HttpRule` is +// typically specified as an `google.api.http` annotation on the gRPC method. +// +// Each mapping specifies a URL path template and an HTTP method. The path +// template may refer to one or more fields in the gRPC request message, as long +// as each field is a non-repeated field with a primitive (non-message) type. +// The path template controls how fields of the request message are mapped to +// the URL path. +// +// Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/{name=messages/*}" +// }; +// } +// } +// message GetMessageRequest { +// string name = 1; // Mapped to URL path. +// } +// message Message { +// string text = 1; // The resource content. +// } +// +// This enables an HTTP REST to gRPC mapping as below: +// +// HTTP | gRPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` +// +// Any fields in the request message which are not bound by the path template +// automatically become HTTP query parameters if there is no HTTP request body. +// For example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get:"/v1/messages/{message_id}" +// }; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // Mapped to URL path. +// int64 revision = 2; // Mapped to URL query parameter `revision`. +// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +// } +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | gRPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | +// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: +// "foo"))` +// +// Note that fields which are mapped to URL query parameters must have a +// primitive type or a repeated primitive type or a non-repeated message type. +// In the case of a repeated type, the parameter can be repeated in the URL +// as `...?param=A¶m=B`. In the case of a message type, each field of the +// message is mapped to a separate parameter, such as +// `...?foo.a=A&foo.b=B&foo.c=C`. +// +// For HTTP methods that allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | gRPC +// -----|----- +// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +// "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | gRPC +// -----|----- +// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +// "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice when +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// This enables the following two alternative HTTP JSON to RPC mappings: +// +// HTTP | gRPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: +// "123456")` +// +// ## Rules for HTTP mapping +// +// 1. Leaf request fields (recursive expansion nested messages in the request +// message) are classified into three categories: +// - Fields referred by the path template. They are passed via the URL path. +// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP +// request body. +// - All other fields are passed via the URL query parameters, and the +// parameter name is the field path in the request message. A repeated +// field can be represented as multiple query parameters under the same +// name. +// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields +// are passed via URL path and HTTP request body. +// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all +// fields are passed via URL path and URL query parameters. +// +// ### Path template syntax +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single URL path segment. The syntax `**` matches +// zero or more URL path segments, which must be the last part of the URL path +// except the `Verb`. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +// contains any reserved character, such characters should be percent-encoded +// before the matching. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path on the client +// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The +// server side does the reverse decoding. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{var}`. +// +// If a variable contains multiple path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path on the +// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. +// The server side does the reverse decoding, except "%2F" and "%2f" are left +// unchanged. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{+var}`. +// +// ## Using gRPC API Service Configuration +// +// gRPC API Service Configuration (service config) is a configuration language +// for configuring a gRPC service to become a user-facing product. The +// service config is simply the YAML representation of the `google.api.Service` +// proto message. +// +// As an alternative to annotating your proto file, you can configure gRPC +// transcoding in your service config YAML files. You do this by specifying a +// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +// effect as the proto annotation. This can be particularly useful if you +// have a proto that is reused in multiple services. Note that any transcoding +// specified in the service config will override any matching transcoding +// configuration in the proto. +// +// Example: +// +// http: +// rules: +// # Selects a gRPC method and applies HttpRule to it. +// - selector: example.v1.Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// ## Special notes +// +// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +// proto to JSON conversion must follow the [proto3 +// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). +// +// While the single segment variable follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion, the multi segment variable **does not** follow RFC 6570 Section +// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +// for multi segment variables. +// +// The path variables **must not** refer to any repeated or mapped field, +// because client libraries are not capable of handling such variable expansion. +// +// The path variables **must not** capture the leading "/" character. The reason +// is that the most common use case "{var}" does not capture the leading "/" +// character. For consistency, all path variables must share the same behavior. +// +// Repeated message fields must not be mapped to URL query parameters, because +// no client library can support such complicated mapping. +// +// If an API needs to use a JSON array for request or response body, it can map +// the request or response body to a repeated field. However, some gRPC +// Transcoding implementations may not support this feature. +message HttpRule { + // Selects a method to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Maps to HTTP GET. Used for listing and getting information about + // resources. + string get = 2; + + // Maps to HTTP PUT. Used for replacing a resource. + string put = 3; + + // Maps to HTTP POST. Used for creating a resource or performing an action. + string post = 4; + + // Maps to HTTP DELETE. Used for deleting a resource. + string delete = 5; + + // Maps to HTTP PATCH. Used for updating a resource. + string patch = 6; + + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP request + // body, or `*` for mapping all request fields not captured by the path + // pattern to the HTTP body, or omitted for not having any HTTP request body. + // + // NOTE: the referred field must be present at the top-level of the request + // message type. + string body = 7; + + // Optional. The name of the response field whose value is mapped to the HTTP + // response body. When omitted, the entire response message will be used + // as the HTTP response body. + // + // NOTE: The referred field must be present at the top-level of the response + // message type. + string response_body = 12; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/httpbody.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/httpbody.proto new file mode 100644 index 000000000..bc5ea4478 --- /dev/null +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/google/api/httpbody.proto @@ -0,0 +1,77 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; +option java_multiple_files = true; +option java_outer_classname = "HttpBodyProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns +// (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +message HttpBody { + // The HTTP Content-Type header value specifying the content type of the body. + string content_type = 1; + + // The HTTP request/response body as raw binary. + bytes data = 2; + + // Application specific response metadata. Must be set in the first response + // for streaming APIs. + repeated google.protobuf.Any extensions = 3; +} \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/go.mod b/code/go/0chain.net/blobbercore/go.mod index 127e31178..8cb2ae902 100644 --- a/code/go/0chain.net/blobbercore/go.mod +++ b/code/go/0chain.net/blobbercore/go.mod @@ -9,16 +9,22 @@ require ( 0chain.net/core v0.0.0 github.com/0chain/gosdk v1.1.6 github.com/go-ini/ini v1.55.0 // indirect + github.com/golang/protobuf v1.5.0 github.com/gorilla/context v1.1.1 // indirect github.com/gorilla/mux v1.6.2 + github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/jackc/pgproto3/v2 v2.0.4 // indirect github.com/minio/minio-go v6.0.14+incompatible github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce github.com/spf13/viper v1.7.0 + github.com/stretchr/testify v1.5.1 go.uber.org/zap v1.15.0 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 + google.golang.org/grpc v1.33.1 + google.golang.org/protobuf v1.26.0 gopkg.in/ini.v1 v1.61.0 // indirect gorm.io/datatypes v0.0.0-20200806042100-bc394008dd0d gorm.io/driver/postgres v1.0.0 diff --git a/code/go/0chain.net/blobbercore/go.sum b/code/go/0chain.net/blobbercore/go.sum index 1e2991713..65c362c72 100644 --- a/code/go/0chain.net/blobbercore/go.sum +++ b/code/go/0chain.net/blobbercore/go.sum @@ -25,6 +25,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -33,8 +34,10 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -55,6 +58,10 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/didip/tollbooth v4.0.2+incompatible h1:fVSa33JzSz0hoh2NxpwZtksAzAgd7zjmGO20HCZtF4M= github.com/didip/tollbooth v4.0.2+incompatible/go.mod h1:A9b0665CE6l1KmzpDws2++elm/CsuWBMa5Jv4WY0PEY= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -72,9 +79,11 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -82,15 +91,23 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -101,9 +118,13 @@ github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0 h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/h2non/filetype v1.0.9 h1:Y9YFg/WJNd7XoC5h3WD+GZSxHmuRRDyJQ7fcIlIJplI= github.com/h2non/filetype v1.0.9/go.mod h1:isekKqOuhMj+s/7r3rIeTErIRy4Rub5uBWHfvMusLMU= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= @@ -204,6 +225,7 @@ github.com/klauspost/reedsolomon v1.9.2 h1:E9CMS2Pqbv+C7tsrYad4YC9MfhnMVWhMRsTi7 github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= github.com/koding/cache v0.0.0-20161222233015-e8a81b0b3f20/go.mod h1:sh5SGGmQVGUkWDnxevz0I2FJ4TeC18hRPRjKVBMb2kA= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -268,6 +290,7 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -276,6 +299,7 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce h1:aP+C+YbHZfOQlutA4p4soHi7rVUqHQdWEVMSkHfDTqY= github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce/go.mod h1:3j2R4OIe/SeS6YDhICBy22RWjJC5eNCJ1V+9+NVNYlo= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= @@ -288,6 +312,7 @@ github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoM github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -309,6 +334,7 @@ github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -411,9 +437,12 @@ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -463,6 +492,7 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -501,11 +531,23 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 h1:fiNLklpBwWK1mth30Hlwk+fcdBmIALlgF5iy77O37Ig= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= @@ -523,6 +565,7 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gorm.io/datatypes v0.0.0-20200806042100-bc394008dd0d h1:cEzkQplur9Z++gqjh48MF692Hkdl/jTkbo/7YQ5yssM= @@ -545,6 +588,7 @@ gorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/code/go/0chain.net/blobbercore/handler/convert.go b/code/go/0chain.net/blobbercore/handler/convert.go new file mode 100644 index 000000000..16808ebca --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/convert.go @@ -0,0 +1,72 @@ +package handler + +import ( + "0chain.net/blobbercore/allocation" + "0chain.net/blobbercore/blobbergrpc" + "0chain.net/blobbercore/stats" + "0chain.net/blobbercore/writemarker" +) + +func AllocationToGRPCAllocation(alloc *allocation.Allocation) *blobbergrpc.Allocation { + terms := make([]*blobbergrpc.Term, len(alloc.Terms)) + for _, t := range alloc.Terms { + terms = append(terms, &blobbergrpc.Term{ + ID: t.ID, + BlobberID: t.BlobberID, + AllocationID: t.AllocationID, + ReadPrice: t.ReadPrice, + WritePrice: t.WritePrice, + }) + } + return &blobbergrpc.Allocation{ + ID: alloc.ID, + Tx: alloc.Tx, + TotalSize: alloc.TotalSize, + UsedSize: alloc.UsedSize, + OwnerID: alloc.OwnerID, + OwnerPublicKey: alloc.OwnerPublicKey, + Expiration: int64(alloc.Expiration), + AllocationRoot: alloc.AllocationRoot, + BlobberSize: alloc.BlobberSize, + BlobberSizeUsed: alloc.BlobberSizeUsed, + LatestRedeemedWM: alloc.LatestRedeemedWM, + IsRedeemRequired: alloc.IsRedeemRequired, + TimeUnit: int64(alloc.TimeUnit), + CleanedUp: alloc.CleanedUp, + Finalized: alloc.Finalized, + Terms: terms, + PayerID: alloc.PayerID, + } +} + +func FileStatsToFileStatsGRPC(fileStats *stats.FileStats) *blobbergrpc.FileStats { + if fileStats == nil { + return &blobbergrpc.FileStats{} + } + + return &blobbergrpc.FileStats{ + ID: fileStats.ID, + RefID: fileStats.RefID, + NumUpdates: fileStats.NumUpdates, + NumBlockDownloads: fileStats.NumBlockDownloads, + SuccessChallenges: fileStats.SuccessChallenges, + FailedChallenges: fileStats.FailedChallenges, + LastChallengeResponseTxn: fileStats.LastChallengeResponseTxn, + WriteMarkerRedeemTxn: fileStats.WriteMarkerRedeemTxn, + CreatedAt: fileStats.CreatedAt.UnixNano(), + UpdatedAt: fileStats.UpdatedAt.UnixNano(), + } +} + +func WriteMarkerToWriteMarkerGRPC(wm writemarker.WriteMarker) *blobbergrpc.WriteMarker { + return &blobbergrpc.WriteMarker{ + AllocationRoot: wm.AllocationRoot, + PreviousAllocationRoot: wm.PreviousAllocationRoot, + AllocationID: wm.AllocationID, + Size: wm.Size, + BlobberID: wm.BlobberID, + Timestamp: int64(wm.Timestamp), + ClientID: wm.ClientID, + Signature: wm.Signature, + } +} diff --git a/code/go/0chain.net/blobbercore/handler/grpcMiddleware.go b/code/go/0chain.net/blobbercore/handler/grpcMiddleware.go new file mode 100644 index 000000000..ef1b05cbb --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/grpcMiddleware.go @@ -0,0 +1,51 @@ +package handler + +import ( + "context" + + "0chain.net/core/common" + "0chain.net/core/logging" + grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" + "go.uber.org/zap" + "google.golang.org/grpc" +) + +func unaryDatabaseTransactionInjector() grpc.UnaryServerInterceptor { + return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + logger := ctxzap.Extract(ctx) + + ctx = GetMetaDataStore().CreateTransaction(ctx) + resp, err := handler(ctx, req) + if err != nil { + var rollErr = GetMetaDataStore().GetTransaction(ctx).Rollback().Error + if rollErr != nil { + logger.Error("couldn't rollback", zap.Error(err)) + } + return nil, err + } + + err = GetMetaDataStore().GetTransaction(ctx).Commit().Error + if err != nil { + return nil, common.NewErrorf("commit_error", + "error committing to meta store: %v", err) + } + + return resp, err + } +} + +func NewServerWithMiddlewares() *grpc.Server { + return grpc.NewServer( + grpc.ChainStreamInterceptor( + grpc_zap.StreamServerInterceptor(logging.Logger), + grpc_recovery.StreamServerInterceptor(), + ), + grpc.ChainUnaryInterceptor( + grpc_zap.UnaryServerInterceptor(logging.Logger), + grpc_recovery.UnaryServerInterceptor(), + unaryDatabaseTransactionInjector(), + ), + ) +} diff --git a/code/go/0chain.net/blobbercore/handler/grpchandler.go b/code/go/0chain.net/blobbercore/handler/grpchandler.go new file mode 100644 index 000000000..17eb75086 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/grpchandler.go @@ -0,0 +1,347 @@ +package handler + +import ( + "context" + "strconv" + + "0chain.net/blobbercore/allocation" + + "0chain.net/blobbercore/stats" + "0chain.net/blobbercore/writemarker" + + "0chain.net/blobbercore/reference" + + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + + "0chain.net/core/common" + + "go.uber.org/zap" + + "github.com/gorilla/mux" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + "google.golang.org/grpc" + + "0chain.net/blobbercore/blobbergrpc" +) + +type StorageHandlerI interface { + verifyAllocation(ctx context.Context, tx string, readonly bool) (alloc *allocation.Allocation, err error) + verifyAuthTicket(ctx context.Context, authTokenString string, allocationObj *allocation.Allocation, refRequested *reference.Ref, clientID string) (bool, error) +} + +// PackageHandler is an interface for all static functions that may need to be mocked +type PackageHandler interface { + GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) + GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) + GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) + IsACollaborator(ctx context.Context, refID int64, clientID string) bool + GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) + GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) + GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) + GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) +} + +type packageHandler struct{} + +func (r *packageHandler) GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { + return reference.GetRefWithChildren(ctx, allocationID, path) +} + +func (r *packageHandler) GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) { + return reference.GetObjectPathGRPC(ctx, allocationID, blockNum) +} + +func (r *packageHandler) GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) { + return stats.GetFileStats(ctx, refID) +} + +func (r *packageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) { + return writemarker.GetWriteMarkerEntity(ctx, allocation_root) +} + +func (r *packageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { + return reference.GetReferenceFromLookupHash(ctx, allocationID, path_hash) +} + +func (r *packageHandler) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) { + return reference.GetCommitMetaTxns(ctx, refID) +} + +func (r *packageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { + return reference.GetCollaborators(ctx, refID) +} + +func (r *packageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { + return reference.IsACollaborator(ctx, refID, clientID) +} + +type blobberGRPCService struct { + storageHandler StorageHandlerI + packageHandler PackageHandler + blobbergrpc.UnimplementedBlobberServer +} + +func RegisterGRPCServices(r *mux.Router, server *grpc.Server) { + packHandler := &packageHandler{} + blobberService := newGRPCBlobberService(&storageHandler, packHandler) + mux := runtime.NewServeMux() + blobbergrpc.RegisterBlobberServer(server, blobberService) + blobbergrpc.RegisterBlobberHandlerServer(context.Background(), mux, blobberService) + r.PathPrefix("/").Handler(mux) +} + +func newGRPCBlobberService(sh StorageHandlerI, r PackageHandler) *blobberGRPCService { + return &blobberGRPCService{ + storageHandler: sh, + packageHandler: r, + } +} + +func (b *blobberGRPCService) GetAllocation(ctx context.Context, request *blobbergrpc.GetAllocationRequest) (*blobbergrpc.GetAllocationResponse, error) { + ctx = setupGRPCHandlerContext(ctx, request.Context) + + allocation, err := b.storageHandler.verifyAllocation(ctx, request.Id, false) + if err != nil { + return nil, err + } + + return &blobbergrpc.GetAllocationResponse{Allocation: AllocationToGRPCAllocation(allocation)}, nil +} + +func (b *blobberGRPCService) GetFileMetaData(ctx context.Context, req *blobbergrpc.GetFileMetaDataRequest) (*blobbergrpc.GetFileMetaDataResponse, error) { + logger := ctxzap.Extract(ctx) + allocationObj, err := b.storageHandler.verifyAllocation(ctx, req.Allocation, true) + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + } + allocationID := allocationObj.ID + + clientID := req.Context.Client + if len(clientID) == 0 { + return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + } + + path_hash := req.PathHash + path := req.Path + if len(path_hash) == 0 { + if len(path) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid path") + } + path_hash = reference.GetReferenceLookup(allocationID, path) + } + + fileref, err := b.packageHandler.GetReferenceFromLookupHash(ctx, allocationID, path_hash) + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid file path. "+err.Error()) + } + + if fileref.Type != reference.FILE { + return nil, common.NewError("invalid_parameters", "Path is not a file.") + } + + commitMetaTxns, err := b.packageHandler.GetCommitMetaTxns(ctx, fileref.ID) + if err != nil { + logger.Error("Failed to get commitMetaTxns from refID", zap.Error(err), zap.Any("ref_id", fileref.ID)) + } + fileref.CommitMetaTxns = commitMetaTxns + + collaborators, err := b.packageHandler.GetCollaborators(ctx, fileref.ID) + if err != nil { + logger.Error("Failed to get collaborators from refID", zap.Error(err), zap.Any("ref_id", fileref.ID)) + } + + authTokenString := req.AuthToken + + if (allocationObj.OwnerID != clientID && + allocationObj.PayerID != clientID && + !b.packageHandler.IsACollaborator(ctx, fileref.ID, clientID)) || len(authTokenString) > 0 { + authTicketVerified, err := b.storageHandler.verifyAuthTicket(ctx, req.AuthToken, allocationObj, fileref, clientID) + if err != nil { + return nil, err + } + if !authTicketVerified { + return nil, common.NewError("auth_ticket_verification_failed", "Could not verify the auth ticket.") + } + fileref.Path = "" + } + + var collaboratorsGRPC []*blobbergrpc.Collaborator + for _, c := range collaborators { + collaboratorsGRPC = append(collaboratorsGRPC, &blobbergrpc.Collaborator{ + RefId: c.RefID, + ClientId: c.ClientID, + CreatedAt: c.CreatedAt.UnixNano(), + }) + } + + return &blobbergrpc.GetFileMetaDataResponse{ + MetaData: reference.FileRefToFileRefGRPC(fileref), + Collaborators: collaboratorsGRPC, + }, nil +} + +func (b *blobberGRPCService) GetFileStats(ctx context.Context, req *blobbergrpc.GetFileStatsRequest) (*blobbergrpc.GetFileStatsResponse, error) { + allocationTx := req.Context.Allocation + allocationObj, err := b.storageHandler.verifyAllocation(ctx, allocationTx, true) + + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + } + allocationID := allocationObj.ID + + clientID := req.Context.Client + if len(clientID) == 0 || allocationObj.OwnerID != clientID { + return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + } + + path_hash := req.PathHash + path := req.Path + if len(path_hash) == 0 { + if len(path) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid path") + } + path_hash = reference.GetReferenceLookup(allocationID, path) + } + + fileref, err := b.packageHandler.GetReferenceFromLookupHash(ctx, allocationID, path_hash) + + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid file path. "+err.Error()) + } + + if fileref.Type != reference.FILE { + return nil, common.NewError("invalid_parameters", "Path is not a file.") + } + + stats, _ := b.packageHandler.GetFileStats(ctx, fileref.ID) + wm, _ := b.packageHandler.GetWriteMarkerEntity(ctx, fileref.WriteMarker) + if wm != nil && stats != nil { + stats.WriteMarkerRedeemTxn = wm.CloseTxnID + } + + return &blobbergrpc.GetFileStatsResponse{ + MetaData: reference.FileRefToFileRefGRPC(fileref), + Stats: FileStatsToFileStatsGRPC(stats), + }, nil +} + +func (b *blobberGRPCService) ListEntities(ctx context.Context, req *blobbergrpc.ListEntitiesRequest) (*blobbergrpc.ListEntitiesResponse, error) { + logger := ctxzap.Extract(ctx) + + clientID := req.Context.Client + allocationTx := req.Context.Allocation + allocationObj, err := b.storageHandler.verifyAllocation(ctx, allocationTx, true) + + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + } + allocationID := allocationObj.ID + + if len(clientID) == 0 { + return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + } + + path_hash := req.PathHash + path := req.Path + if len(path_hash) == 0 { + if len(path) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid path") + } + path_hash = reference.GetReferenceLookup(allocationID, path) + } + + logger.Info("Path Hash for list dir :" + path_hash) + + fileref, err := b.packageHandler.GetReferenceFromLookupHash(ctx, allocationID, path_hash) + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid path. "+err.Error()) + } + authTokenString := req.AuthToken + if clientID != allocationObj.OwnerID || len(authTokenString) > 0 { + authTicketVerified, err := b.storageHandler.verifyAuthTicket(ctx, authTokenString, allocationObj, fileref, clientID) + if err != nil { + return nil, err + } + if !authTicketVerified { + return nil, common.NewError("auth_ticket_verification_failed", "Could not verify the auth ticket.") + } + } + + dirref, err := b.packageHandler.GetRefWithChildren(ctx, allocationID, fileref.Path) + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid path. "+err.Error()) + } + + if clientID != allocationObj.OwnerID { + dirref.Path = "" + } + + var entities []*blobbergrpc.FileRef + for _, entity := range dirref.Children { + if clientID != allocationObj.OwnerID { + entity.Path = "" + } + entities = append(entities, reference.FileRefToFileRefGRPC(entity)) + } + refGRPC := reference.FileRefToFileRefGRPC(dirref) + refGRPC.DirMetaData.Children = entities + + return &blobbergrpc.ListEntitiesResponse{ + AllocationRoot: allocationObj.AllocationRoot, + MetaData: refGRPC, + }, nil +} + +func (b *blobberGRPCService) GetObjectPath(ctx context.Context, req *blobbergrpc.GetObjectPathRequest) (*blobbergrpc.GetObjectPathResponse, error) { + allocationTx := req.Context.Allocation + allocationObj, err := b.storageHandler.verifyAllocation(ctx, allocationTx, false) + + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + } + allocationID := allocationObj.ID + + clientID := req.Context.Client + if len(clientID) == 0 || allocationObj.OwnerID != clientID { + return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + } + path := req.Path + if len(path) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid path") + } + + blockNumStr := req.BlockNum + if len(blockNumStr) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid path") + } + + blockNum, err := strconv.ParseInt(blockNumStr, 10, 64) + if err != nil || blockNum < 0 { + return nil, common.NewError("invalid_parameters", "Invalid block number") + } + + objectPath, err := b.packageHandler.GetObjectPathGRPC(ctx, allocationID, blockNum) + if err != nil { + return nil, err + } + + var latestWM *writemarker.WriteMarkerEntity + if len(allocationObj.AllocationRoot) == 0 { + latestWM = nil + } else { + latestWM, err = b.packageHandler.GetWriteMarkerEntity(ctx, allocationObj.AllocationRoot) + if err != nil { + return nil, common.NewError("latest_write_marker_read_error", "Error reading the latest write marker for allocation."+err.Error()) + } + } + var latestWriteMarketGRPC *blobbergrpc.WriteMarker + if latestWM != nil { + latestWriteMarketGRPC = WriteMarkerToWriteMarkerGRPC(latestWM.WM) + } + return &blobbergrpc.GetObjectPathResponse{ + ObjectPath: objectPath, + LatestWriteMarker: latestWriteMarketGRPC, + }, nil +} diff --git a/code/go/0chain.net/blobbercore/handler/grpchandler_test.go b/code/go/0chain.net/blobbercore/handler/grpchandler_test.go new file mode 100644 index 000000000..5580855b2 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/grpchandler_test.go @@ -0,0 +1,396 @@ +package handler + +import ( + "context" + "errors" + "testing" + + "0chain.net/blobbercore/stats" + + "0chain.net/blobbercore/reference" + + "0chain.net/blobbercore/mocks" + + "github.com/stretchr/testify/assert" + + "0chain.net/blobbercore/allocation" + + "github.com/stretchr/testify/mock" + + "0chain.net/blobbercore/blobbergrpc" +) + +// StorageHandlerI is an autogenerated mock type for the StorageHandlerI type +type storageHandlerI struct { + mock.Mock +} + +// verifyAllocation provides a mock function with given fields: ctx, tx, readonly +func (_m *storageHandlerI) verifyAllocation(ctx context.Context, tx string, readonly bool) (*allocation.Allocation, error) { + ret := _m.Called(ctx, tx, readonly) + + var r0 *allocation.Allocation + if rf, ok := ret.Get(0).(func(context.Context, string, bool) *allocation.Allocation); ok { + r0 = rf(ctx, tx, readonly) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*allocation.Allocation) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, tx, readonly) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// verifyAuthTicket provides a mock function with given fields: ctx, authTokenString, allocationObj, refRequested, clientID +func (_m *storageHandlerI) verifyAuthTicket(ctx context.Context, authTokenString string, allocationObj *allocation.Allocation, refRequested *reference.Ref, clientID string) (bool, error) { + ret := _m.Called(ctx, authTokenString, allocationObj, refRequested, clientID) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, string, *allocation.Allocation, *reference.Ref, string) bool); ok { + r0 = rf(ctx, authTokenString, allocationObj, refRequested, clientID) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, *allocation.Allocation, *reference.Ref, string) error); ok { + r1 = rf(ctx, authTokenString, allocationObj, refRequested, clientID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +func TestBlobberGRPCService_GetAllocation_Success(t *testing.T) { + req := &blobbergrpc.GetAllocationRequest{ + Context: &blobbergrpc.RequestContext{}, + Id: "something", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Id, false).Return(&allocation.Allocation{ + Tx: req.Id, + }, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + allocation, err := svc.GetAllocation(context.Background(), req) + assert.NoError(t, err) + assert.Equal(t, allocation.Allocation.Tx, req.Id) +} + +func TestBlobberGRPCService_GetAllocation_invalidAllocation(t *testing.T) { + req := &blobbergrpc.GetAllocationRequest{ + Context: &blobbergrpc.RequestContext{}, + Id: "invalid_allocation", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Id, false).Return(nil, errors.New("some error")) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + _, err := svc.GetAllocation(context.Background(), req) + if err == nil { + t.Fatal("expected error") + } + + assert.Equal(t, err.Error(), "some error") +} + +func TestBlobberGRPCService_GetFileMetaData_Success(t *testing.T) { + req := &blobbergrpc.GetFileMetaDataRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "client", + ClientKey: "", + Allocation: "", + }, + Path: "path", + PathHash: "path_hash", + AuthToken: "testval", + Allocation: "something", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + }, nil) + mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ + Name: "test", + Type: reference.FILE, + }, nil) + mockReferencePackage.On("GetCommitMetaTxns", mock.Anything, mock.Anything).Return(nil, nil) + mockReferencePackage.On("GetCollaborators", mock.Anything, mock.Anything).Return([]reference.Collaborator{ + reference.Collaborator{ + RefID: 1, + ClientID: "test", + }, + }, nil) + mockReferencePackage.On("IsACollaborator", mock.Anything, mock.Anything, mock.Anything).Return(true) + mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + resp, err := svc.GetFileMetaData(context.Background(), req) + if err != nil { + t.Fatal("unexpected error") + } + + assert.Equal(t, resp.MetaData.FileMetaData.Name, "test") +} + +func TestBlobberGRPCService_GetFileMetaData_FileNotExist(t *testing.T) { + req := &blobbergrpc.GetFileMetaDataRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "client", + ClientKey: "", + Allocation: "", + }, + Path: "path", + PathHash: "path_hash", + AuthToken: "testval", + Allocation: "something", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + }, nil) + mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("file doesnt exist")) + mockReferencePackage.On("GetCommitMetaTxns", mock.Anything, mock.Anything).Return(nil, nil) + mockReferencePackage.On("GetCollaborators", mock.Anything, mock.Anything).Return([]reference.Collaborator{ + reference.Collaborator{ + RefID: 1, + ClientID: "test", + }, + }, nil) + mockReferencePackage.On("IsACollaborator", mock.Anything, mock.Anything, mock.Anything).Return(true) + mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + _, err := svc.GetFileMetaData(context.Background(), req) + if err == nil { + t.Fatal("expected error") + } +} + +func TestBlobberGRPCService_GetFileStats_Success(t *testing.T) { + req := &blobbergrpc.GetFileStatsRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "owner", + ClientKey: "", + Allocation: "", + }, + Path: "path", + PathHash: "path_hash", + Allocation: "", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + OwnerID: "owner", + }, nil) + mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ + ID: 123, + Name: "test", + Type: reference.FILE, + }, nil) + mockReferencePackage.On("GetFileStats", mock.Anything, int64(123)).Return(&stats.FileStats{ + NumBlockDownloads: 10, + }, nil) + mockReferencePackage.On("GetWriteMarkerEntity", mock.Anything, mock.Anything).Return(nil, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + resp, err := svc.GetFileStats(context.Background(), req) + if err != nil { + t.Fatal("unexpected error") + } + + assert.Equal(t, resp.MetaData.FileMetaData.Name, "test") + assert.Equal(t, resp.Stats.NumBlockDownloads, int64(10)) +} + +func TestBlobberGRPCService_GetFileStats_FileNotExist(t *testing.T) { + req := &blobbergrpc.GetFileStatsRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "owner", + ClientKey: "", + Allocation: "", + }, + Path: "path", + PathHash: "path_hash", + Allocation: "", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + OwnerID: "owner", + }, nil) + mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("file does not exist")) + mockReferencePackage.On("GetFileStats", mock.Anything, int64(123)).Return(&stats.FileStats{ + NumBlockDownloads: 10, + }, nil) + mockReferencePackage.On("GetWriteMarkerEntity", mock.Anything, mock.Anything).Return(nil, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + _, err := svc.GetFileStats(context.Background(), req) + if err == nil { + t.Fatal("expected error") + } +} + +func TestBlobberGRPCService_ListEntities_Success(t *testing.T) { + req := &blobbergrpc.ListEntitiesRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "client", + ClientKey: "", + Allocation: "", + }, + Path: "path", + PathHash: "path_hash", + AuthToken: "something", + Allocation: "", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + OwnerID: "owner", + AllocationRoot: "/allocationroot", + }, nil) + mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ + Name: "test", + Type: reference.FILE, + }, nil) + mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + mockReferencePackage.On("GetRefWithChildren", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ + Name: "test", + Type: reference.DIRECTORY, + }, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + resp, err := svc.ListEntities(context.Background(), req) + if err != nil { + t.Fatal("unexpected error") + } + + assert.Equal(t, resp.AllocationRoot, "/allocationroot") +} + +func TestBlobberGRPCService_ListEntities_InvalidAuthTicket(t *testing.T) { + req := &blobbergrpc.ListEntitiesRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "client", + ClientKey: "", + Allocation: "", + }, + Path: "path", + PathHash: "path_hash", + AuthToken: "something", + Allocation: "", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + OwnerID: "owner", + }, nil) + mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ + Name: "test", + Type: reference.FILE, + }, nil) + mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(false, nil) + mockReferencePackage.On("GetRefWithChildren", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ + Name: "test", + Type: reference.DIRECTORY, + }, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + _, err := svc.ListEntities(context.Background(), req) + if err == nil { + t.Fatal("expected error") + } +} + +func TestBlobberGRPCService_GetObjectPath_Success(t *testing.T) { + req := &blobbergrpc.GetObjectPathRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "owner", + ClientKey: "", + Allocation: "", + }, + Allocation: "", + Path: "path", + BlockNum: "120", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(&allocation.Allocation{ + ID: "allocationId", + Tx: req.Allocation, + OwnerID: "owner", + }, nil) + mockReferencePackage.On("GetObjectPathGRPC", mock.Anything, mock.Anything, mock.Anything).Return(&blobbergrpc.ObjectPath{ + RootHash: "hash", + FileBlockNum: 120, + }, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + resp, err := svc.GetObjectPath(context.Background(), req) + if err != nil { + t.Fatal("unexpected error") + } + + assert.Equal(t, resp.ObjectPath.RootHash, "hash") + assert.Equal(t, resp.ObjectPath.FileBlockNum, int64(120)) + +} + +func TestBlobberGRPCService_GetObjectPath_InvalidAllocation(t *testing.T) { + req := &blobbergrpc.GetObjectPathRequest{ + Context: &blobbergrpc.RequestContext{ + Client: "owner", + ClientKey: "", + Allocation: "", + }, + Allocation: "", + Path: "path", + BlockNum: "120", + } + + mockStorageHandler := &storageHandlerI{} + mockReferencePackage := &mocks.PackageHandler{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(nil, errors.New("invalid allocation")) + mockReferencePackage.On("GetObjectPathGRPC", mock.Anything, mock.Anything, mock.Anything).Return(&blobbergrpc.ObjectPath{ + RootHash: "hash", + FileBlockNum: 120, + }, nil) + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + _, err := svc.GetObjectPath(context.Background(), req) + if err == nil { + t.Fatal("expected error") + } +} diff --git a/code/go/0chain.net/blobbercore/handler/helper.go b/code/go/0chain.net/blobbercore/handler/helper.go new file mode 100644 index 000000000..c7d6bc64b --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/helper.go @@ -0,0 +1,18 @@ +package handler + +import ( + "context" + + "0chain.net/blobbercore/blobbergrpc" + "0chain.net/blobbercore/constants" +) + +func setupGRPCHandlerContext(ctx context.Context, r *blobbergrpc.RequestContext) context.Context { + ctx = context.WithValue(ctx, constants.CLIENT_CONTEXT_KEY, + r.Client) + ctx = context.WithValue(ctx, constants.CLIENT_KEY_CONTEXT_KEY, + r.ClientKey) + ctx = context.WithValue(ctx, constants.ALLOCATION_CONTEXT_KEY, + r.Allocation) + return ctx +} diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_handler.go b/code/go/0chain.net/blobbercore/handler/object_operation_handler.go index 4e80e82ce..c125204e6 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_handler.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_handler.go @@ -291,7 +291,7 @@ func (fsh *StorageHandler) DownloadFile(ctx context.Context, r *http.Request) ( !isACollaborator) || len(authTokenString) > 0 { var authTicketVerified bool - authTicketVerified, err = fsh.verifyAuthTicket(ctx, r, allocationObj, + authTicketVerified, err = fsh.verifyAuthTicket(ctx, r.FormValue("auth_token"), allocationObj, fileref, clientID) if err != nil { return nil, common.NewErrorf("download_file", diff --git a/code/go/0chain.net/blobbercore/handler/storage_handler.go b/code/go/0chain.net/blobbercore/handler/storage_handler.go index 1a45741db..0684e29a8 100644 --- a/code/go/0chain.net/blobbercore/handler/storage_handler.go +++ b/code/go/0chain.net/blobbercore/handler/storage_handler.go @@ -51,8 +51,7 @@ func (fsh *StorageHandler) verifyAllocation(ctx context.Context, tx string, return } -func (fsh *StorageHandler) verifyAuthTicket(ctx context.Context, r *http.Request, allocationObj *allocation.Allocation, refRequested *reference.Ref, clientID string) (bool, error) { - authTokenString := r.FormValue("auth_token") +func (fsh *StorageHandler) verifyAuthTicket(ctx context.Context, authTokenString string, allocationObj *allocation.Allocation, refRequested *reference.Ref, clientID string) (bool, error) { if len(authTokenString) == 0 { return false, common.NewError("invalid_parameters", "Auth ticket required if data read by anyone other than owner.") } @@ -176,7 +175,7 @@ func (fsh *StorageHandler) GetFileMeta(ctx context.Context, r *http.Request) (in if (allocationObj.OwnerID != clientID && allocationObj.PayerID != clientID && !reference.IsACollaborator(ctx, fileref.ID, clientID)) || len(authTokenString) > 0 { - authTicketVerified, err := fsh.verifyAuthTicket(ctx, r, allocationObj, fileref, clientID) + authTicketVerified, err := fsh.verifyAuthTicket(ctx, r.FormValue("auth_token"), allocationObj, fileref, clientID) if err != nil { return nil, err } @@ -229,7 +228,7 @@ func (fsh *StorageHandler) AddCommitMetaTxn(ctx context.Context, r *http.Request authTokenString := r.FormValue("auth_token") if clientID != allocationObj.OwnerID || len(authTokenString) > 0 { - authTicketVerified, err := fsh.verifyAuthTicket(ctx, r, allocationObj, fileref, clientID) + authTicketVerified, err := fsh.verifyAuthTicket(ctx, r.FormValue("auth_token"), allocationObj, fileref, clientID) if err != nil { return nil, err } @@ -427,7 +426,7 @@ func (fsh *StorageHandler) ListEntities(ctx context.Context, r *http.Request) (* } authTokenString := r.FormValue("auth_token") if clientID != allocationObj.OwnerID || len(authTokenString) > 0 { - authTicketVerified, err := fsh.verifyAuthTicket(ctx, r, allocationObj, fileref, clientID) + authTicketVerified, err := fsh.verifyAuthTicket(ctx, r.FormValue("auth_token"), allocationObj, fileref, clientID) if err != nil { return nil, err } diff --git a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go new file mode 100644 index 000000000..93cc02e48 --- /dev/null +++ b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go @@ -0,0 +1,197 @@ +// Code generated by mockery v0.0.0-dev. DO NOT EDIT. + +package mocks + +import ( + context "context" + + blobbergrpc "0chain.net/blobbercore/blobbergrpc" + + mock "github.com/stretchr/testify/mock" + + reference "0chain.net/blobbercore/reference" + + stats "0chain.net/blobbercore/stats" + + writemarker "0chain.net/blobbercore/writemarker" +) + +// PackageHandler is an autogenerated mock type for the PackageHandler type +type PackageHandler struct { + mock.Mock +} + +// GetCollaborators provides a mock function with given fields: ctx, refID +func (_m *PackageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { + ret := _m.Called(ctx, refID) + + var r0 []reference.Collaborator + if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.Collaborator); ok { + r0 = rf(ctx, refID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]reference.Collaborator) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, refID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetCommitMetaTxns provides a mock function with given fields: ctx, refID +func (_m *PackageHandler) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) { + ret := _m.Called(ctx, refID) + + var r0 []reference.CommitMetaTxn + if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.CommitMetaTxn); ok { + r0 = rf(ctx, refID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]reference.CommitMetaTxn) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, refID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetFileStats provides a mock function with given fields: ctx, refID +func (_m *PackageHandler) GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) { + ret := _m.Called(ctx, refID) + + var r0 *stats.FileStats + if rf, ok := ret.Get(0).(func(context.Context, int64) *stats.FileStats); ok { + r0 = rf(ctx, refID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*stats.FileStats) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, refID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetObjectPathGRPC provides a mock function with given fields: ctx, allocationID, blockNum +func (_m *PackageHandler) GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) { + ret := _m.Called(ctx, allocationID, blockNum) + + var r0 *blobbergrpc.ObjectPath + if rf, ok := ret.Get(0).(func(context.Context, string, int64) *blobbergrpc.ObjectPath); ok { + r0 = rf(ctx, allocationID, blockNum) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*blobbergrpc.ObjectPath) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok { + r1 = rf(ctx, allocationID, blockNum) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetRefWithChildren provides a mock function with given fields: ctx, allocationID, path +func (_m *PackageHandler) GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, path) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, allocationID, path) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetReferenceFromLookupHash provides a mock function with given fields: ctx, allocationID, path_hash +func (_m *PackageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, path_hash) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, path_hash) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, allocationID, path_hash) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetWriteMarkerEntity provides a mock function with given fields: ctx, allocation_root +func (_m *PackageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) { + ret := _m.Called(ctx, allocation_root) + + var r0 *writemarker.WriteMarkerEntity + if rf, ok := ret.Get(0).(func(context.Context, string) *writemarker.WriteMarkerEntity); ok { + r0 = rf(ctx, allocation_root) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*writemarker.WriteMarkerEntity) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, allocation_root) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// IsACollaborator provides a mock function with given fields: ctx, refID, clientID +func (_m *PackageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { + ret := _m.Called(ctx, refID, clientID) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, int64, string) bool); ok { + r0 = rf(ctx, refID, clientID) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} diff --git a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json new file mode 100644 index 000000000..61f277199 --- /dev/null +++ b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json @@ -0,0 +1,780 @@ +{ + "swagger": "2.0", + "info": { + "title": "blobber.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "Blobber" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v2/allocation": { + "get": { + "operationId": "Blobber_GetAllocation", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetAllocationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "context.client", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.clientKey", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.allocation", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "id", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/list/{allocation}": { + "get": { + "operationId": "Blobber_ListEntities", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ListEntitiesResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "context.client", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.clientKey", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.allocation", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "path", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pathHash", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "authToken", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/meta/{allocation}": { + "get": { + "operationId": "Blobber_GetFileMetaData", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetFileMetaDataResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "context.client", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.clientKey", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.allocation", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "path", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pathHash", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "authToken", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/objectpath/{allocation}": { + "get": { + "operationId": "Blobber_GetObjectPath", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetObjectPathResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "context.client", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.clientKey", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.allocation", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "Path", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "BlockNum", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/stats/{allocation}": { + "get": { + "operationId": "Blobber_GetFileStats", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetFileStatsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "context.client", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.clientKey", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "context.allocation", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "path", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pathHash", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1Allocation": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Tx": { + "type": "string" + }, + "TotalSize": { + "type": "string", + "format": "int64" + }, + "UsedSize": { + "type": "string", + "format": "int64" + }, + "OwnerID": { + "type": "string" + }, + "OwnerPublicKey": { + "type": "string" + }, + "Expiration": { + "type": "string", + "format": "int64" + }, + "AllocationRoot": { + "type": "string" + }, + "BlobberSize": { + "type": "string", + "format": "int64" + }, + "BlobberSizeUsed": { + "type": "string", + "format": "int64" + }, + "LatestRedeemedWM": { + "type": "string" + }, + "IsRedeemRequired": { + "type": "boolean" + }, + "TimeUnit": { + "type": "string", + "format": "int64" + }, + "CleanedUp": { + "type": "boolean" + }, + "Finalized": { + "type": "boolean" + }, + "Terms": { + "type": "array", + "items": { + "$ref": "#/definitions/v1Term" + } + }, + "PayerID": { + "type": "string" + } + } + }, + "v1Collaborator": { + "type": "object", + "properties": { + "RefId": { + "type": "string", + "format": "int64" + }, + "ClientId": { + "type": "string" + }, + "CreatedAt": { + "type": "string", + "format": "int64" + } + } + }, + "v1CommitMetaTxn": { + "type": "object", + "properties": { + "RefId": { + "type": "string", + "format": "int64" + }, + "TxnId": { + "type": "string" + }, + "CreatedAt": { + "type": "string", + "format": "int64" + } + } + }, + "v1DirMetaData": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "LookupHash": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Path": { + "type": "string" + }, + "Hash": { + "type": "string" + }, + "NumBlocks": { + "type": "string", + "format": "int64" + }, + "PathHash": { + "type": "string" + }, + "Size": { + "type": "string", + "format": "int64" + }, + "CreatedAt": { + "type": "string", + "format": "int64" + }, + "UpdatedAt": { + "type": "string", + "format": "int64" + }, + "Children": { + "type": "array", + "items": { + "$ref": "#/definitions/v1FileRef" + } + } + } + }, + "v1FileMetaData": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "LookupHash": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Path": { + "type": "string" + }, + "Hash": { + "type": "string" + }, + "NumBlocks": { + "type": "string", + "format": "int64" + }, + "PathHash": { + "type": "string" + }, + "CustomMeta": { + "type": "string" + }, + "ContentHash": { + "type": "string" + }, + "Size": { + "type": "string", + "format": "int64" + }, + "MerkleRoot": { + "type": "string" + }, + "ActualFileSize": { + "type": "string", + "format": "int64" + }, + "ActualFileHash": { + "type": "string" + }, + "MimeType": { + "type": "string" + }, + "ThumbnailSize": { + "type": "string", + "format": "int64" + }, + "ThumbnailHash": { + "type": "string" + }, + "ActualThumbnailSize": { + "type": "string", + "format": "int64" + }, + "ActualThumbnailHash": { + "type": "string" + }, + "EncryptedKey": { + "type": "string" + }, + "Attributes": { + "type": "string", + "format": "byte" + }, + "OnCloud": { + "type": "boolean" + }, + "CommitMetaTxns": { + "type": "array", + "items": { + "$ref": "#/definitions/v1CommitMetaTxn" + } + }, + "CreatedAt": { + "type": "string", + "format": "int64" + }, + "UpdatedAt": { + "type": "string", + "format": "int64" + } + } + }, + "v1FileRef": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "FileMetaData": { + "$ref": "#/definitions/v1FileMetaData" + }, + "DirMetaData": { + "$ref": "#/definitions/v1DirMetaData" + } + } + }, + "v1FileStats": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "format": "int64" + }, + "RefID": { + "type": "string", + "format": "int64" + }, + "NumUpdates": { + "type": "string", + "format": "int64" + }, + "NumBlockDownloads": { + "type": "string", + "format": "int64" + }, + "SuccessChallenges": { + "type": "string", + "format": "int64" + }, + "FailedChallenges": { + "type": "string", + "format": "int64" + }, + "LastChallengeResponseTxn": { + "type": "string" + }, + "WriteMarkerRedeemTxn": { + "type": "string" + }, + "CreatedAt": { + "type": "string", + "format": "int64" + }, + "UpdatedAt": { + "type": "string", + "format": "int64" + } + } + }, + "v1GetAllocationResponse": { + "type": "object", + "properties": { + "allocation": { + "$ref": "#/definitions/v1Allocation" + } + } + }, + "v1GetFileMetaDataResponse": { + "type": "object", + "properties": { + "MetaData": { + "$ref": "#/definitions/v1FileRef" + }, + "Collaborators": { + "type": "array", + "items": { + "$ref": "#/definitions/v1Collaborator" + } + } + } + }, + "v1GetFileStatsResponse": { + "type": "object", + "properties": { + "MetaData": { + "$ref": "#/definitions/v1FileRef" + }, + "Stats": { + "$ref": "#/definitions/v1FileStats" + } + } + }, + "v1GetObjectPathResponse": { + "type": "object", + "properties": { + "ObjectPath": { + "$ref": "#/definitions/v1ObjectPath" + }, + "LatestWriteMarker": { + "$ref": "#/definitions/v1WriteMarker" + } + } + }, + "v1ListEntitiesResponse": { + "type": "object", + "properties": { + "AllocationRoot": { + "type": "string" + }, + "MetaData": { + "$ref": "#/definitions/v1FileRef" + } + } + }, + "v1ObjectPath": { + "type": "object", + "properties": { + "RootHash": { + "type": "string" + }, + "Meta": { + "$ref": "#/definitions/v1FileRef" + }, + "Path": { + "$ref": "#/definitions/v1FileRef" + }, + "FileBlockNum": { + "type": "string", + "format": "int64" + } + } + }, + "v1RequestContext": { + "type": "object", + "properties": { + "client": { + "type": "string" + }, + "clientKey": { + "type": "string" + }, + "allocation": { + "type": "string" + } + } + }, + "v1Term": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "format": "int64" + }, + "BlobberID": { + "type": "string" + }, + "AllocationID": { + "type": "string" + }, + "ReadPrice": { + "type": "string", + "format": "int64" + }, + "WritePrice": { + "type": "string", + "format": "int64" + } + } + }, + "v1WriteMarker": { + "type": "object", + "properties": { + "AllocationRoot": { + "type": "string" + }, + "PreviousAllocationRoot": { + "type": "string" + }, + "AllocationID": { + "type": "string" + }, + "Size": { + "type": "string", + "format": "int64" + }, + "BlobberID": { + "type": "string" + }, + "Timestamp": { + "type": "string", + "format": "int64" + }, + "ClientID": { + "type": "string" + }, + "Signature": { + "type": "string" + } + } + } + } +} diff --git a/code/go/0chain.net/blobbercore/reference/objectpath.go b/code/go/0chain.net/blobbercore/reference/objectpath.go index 95681588c..3c1470c24 100644 --- a/code/go/0chain.net/blobbercore/reference/objectpath.go +++ b/code/go/0chain.net/blobbercore/reference/objectpath.go @@ -3,6 +3,8 @@ package reference import ( "context" + "0chain.net/blobbercore/blobbergrpc" + "0chain.net/core/common" ) @@ -14,6 +16,7 @@ type ObjectPath struct { RefID int64 `json:"-"` } +// TODO needs to be refactored func GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*ObjectPath, error) { rootRef, err := GetRefWithSortedChildren(ctx, allocationID, "/") @@ -88,3 +91,153 @@ func GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*O //rootRef.CalculateHash(ctx, false) return &retObj, nil } + +// TODO needs to be refactored +func GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) { + + rootRef, err := GetRefWithSortedChildren(ctx, allocationID, "/") + //fmt.Println("Root ref found with hash : " + rootRef.Hash) + if err != nil { + return nil, common.NewError("invalid_dir_struct", "Allocation root corresponds to an invalid directory structure") + } + + if rootRef.NumBlocks < blockNum { + return nil, common.NewError("invalid_block_num", "Invalid block number"+string(rootRef.NumBlocks)+" / "+string(blockNum)) + } + + if rootRef.NumBlocks == 0 { + children := make([]*blobbergrpc.FileRef, len(rootRef.Children)) + for idx, child := range rootRef.Children { + children[idx] = FileRefToFileRefGRPC(child) + } + path := FileRefToFileRefGRPC(rootRef) + path.DirMetaData.Children = children + return &blobbergrpc.ObjectPath{ + RootHash: rootRef.Hash, + Path: path, + FileBlockNum: 0, + }, nil + } + + found := false + var curRef *Ref + curRef = rootRef + remainingBlocks := blockNum + + result := curRef.GetListingData(ctx) + curResult := result + + for !found { + list := make([]map[string]interface{}, len(curRef.Children)) + for idx, child := range curRef.Children { + list[idx] = child.GetListingData(ctx) + } + curResult["list"] = list + for idx, child := range curRef.Children { + //result.Entities[idx] = child.GetListingData(ctx) + + if child.NumBlocks < remainingBlocks { + remainingBlocks = remainingBlocks - child.NumBlocks + continue + } + if child.Type == FILE { + found = true + curRef = child + break + } + curRef, err = GetRefWithSortedChildren(ctx, allocationID, child.Path) + if err != nil || len(curRef.Hash) == 0 { + return nil, common.NewError("failed_object_path", "Failed to get the object path") + } + curResult = list[idx] + break + } + } + if !found { + return nil, common.NewError("invalid_parameters", "Block num was not found") + } + + var children []*blobbergrpc.FileRef + for _, child := range rootRef.Children { + children = append(children, FileRefToFileRefGRPC(child)) + } + path := FileRefToFileRefGRPC(rootRef) + path.DirMetaData.Children = children + //rootRef.CalculateHash(ctx, false) + return &blobbergrpc.ObjectPath{ + RootHash: rootRef.Hash, + Meta: FileRefToFileRefGRPC(curRef), + Path: path, + FileBlockNum: remainingBlocks, + }, nil +} + +func FileRefToFileRefGRPC(ref *Ref) *blobbergrpc.FileRef { + + var fileMetaData *blobbergrpc.FileMetaData + var dirMetaData *blobbergrpc.DirMetaData + switch ref.Type { + case FILE: + fileMetaData = convertFileRefToFileMetaDataGRPC(ref) + case DIRECTORY: + dirMetaData = convertDirRefToDirMetaDataGRPC(ref) + } + + return &blobbergrpc.FileRef{ + Type: ref.Type, + FileMetaData: fileMetaData, + DirMetaData: dirMetaData, + } +} + +func convertFileRefToFileMetaDataGRPC(fileref *Ref) *blobbergrpc.FileMetaData { + var commitMetaTxnsGRPC []*blobbergrpc.CommitMetaTxn + for _, c := range fileref.CommitMetaTxns { + commitMetaTxnsGRPC = append(commitMetaTxnsGRPC, &blobbergrpc.CommitMetaTxn{ + RefId: c.RefID, + TxnId: c.TxnID, + CreatedAt: c.CreatedAt.UnixNano(), + }) + } + return &blobbergrpc.FileMetaData{ + Type: fileref.Type, + LookupHash: fileref.LookupHash, + Name: fileref.Name, + Path: fileref.Path, + Hash: fileref.Hash, + NumBlocks: fileref.NumBlocks, + PathHash: fileref.PathHash, + CustomMeta: fileref.CustomMeta, + ContentHash: fileref.ContentHash, + Size: fileref.Size, + MerkleRoot: fileref.MerkleRoot, + ActualFileSize: fileref.ActualFileSize, + ActualFileHash: fileref.ActualFileHash, + MimeType: fileref.MimeType, + ThumbnailSize: fileref.ThumbnailSize, + ThumbnailHash: fileref.ThumbnailHash, + ActualThumbnailSize: fileref.ActualThumbnailSize, + ActualThumbnailHash: fileref.ActualThumbnailHash, + EncryptedKey: fileref.EncryptedKey, + Attributes: fileref.Attributes, + OnCloud: fileref.OnCloud, + CommitMetaTxns: commitMetaTxnsGRPC, + CreatedAt: fileref.CreatedAt.UnixNano(), + UpdatedAt: fileref.UpdatedAt.UnixNano(), + } +} + +func convertDirRefToDirMetaDataGRPC(dirref *Ref) *blobbergrpc.DirMetaData { + return &blobbergrpc.DirMetaData{ + Type: dirref.Type, + LookupHash: dirref.LookupHash, + Name: dirref.Name, + Path: dirref.Path, + Hash: dirref.Hash, + NumBlocks: dirref.NumBlocks, + PathHash: dirref.PathHash, + Size: dirref.Size, + CreatedAt: dirref.CreatedAt.UnixNano(), + UpdatedAt: dirref.UpdatedAt.UnixNano(), + } +} diff --git a/code/go/0chain.net/blobbercore/scripts/generate-grpc.sh b/code/go/0chain.net/blobbercore/scripts/generate-grpc.sh new file mode 100644 index 000000000..eacae03fb --- /dev/null +++ b/code/go/0chain.net/blobbercore/scripts/generate-grpc.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +protoc -I ./blobbergrpc/proto --go-grpc_out=. --go_out=. --grpc-gateway_out=. --openapiv2_out=./openapi ./blobbergrpc/proto/blobber.proto \ No newline at end of file diff --git a/docker.local/b0docker-compose.yml b/docker.local/b0docker-compose.yml index 312346924..6030b1930 100644 --- a/docker.local/b0docker-compose.yml +++ b/docker.local/b0docker-compose.yml @@ -61,7 +61,8 @@ services: - ./blobber${BLOBBER}/data/tmp:/tmp ports: - "505${BLOBBER}:505${BLOBBER}" - command: ./bin/blobber --port 505${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt + - "703${BLOBBER}:703${BLOBBER}" + command: ./bin/blobber --port 505${BLOBBER} --grpc_port 703${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt networks: default: testnet0: diff --git a/docker.local/bin/blobber.start_bls.sh b/docker.local/bin/blobber.start_bls.sh index 091c96b39..f3686577b 100755 --- a/docker.local/bin/blobber.start_bls.sh +++ b/docker.local/bin/blobber.start_bls.sh @@ -8,4 +8,4 @@ echo Starting blobber$BLOBBER_ID ... # echo blobber$i -BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose.yml up -d +BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose.yml up diff --git a/docker.local/docker-compose.yml b/docker.local/docker-compose.yml index a5b5e2911..bbc886bf5 100644 --- a/docker.local/docker-compose.yml +++ b/docker.local/docker-compose.yml @@ -55,7 +55,8 @@ services: - ./keys_config:/blobber/keysconfig ports: - "505${BLOBBER}:505${BLOBBER}" - command: ./bin/blobber --port 505${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keys_config/minio_config.txt + - "703${BLOBBER}:703${BLOBBER}" + command: ./bin/blobber --port 505${BLOBBER} --grpc_port 703${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keys_config/minio_config.txt networks: default: testnet0: diff --git a/docker.local/p0docker-compose.yml b/docker.local/p0docker-compose.yml index c940f4a6b..fbcbb45da 100644 --- a/docker.local/p0docker-compose.yml +++ b/docker.local/p0docker-compose.yml @@ -61,7 +61,8 @@ services: - ./blobber${BLOBBER}/data/tmp:/tmp ports: - "505${BLOBBER}:505${BLOBBER}" - command: ./bin/blobber --port 505${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt + - "703${BLOBBER}:703${BLOBBER}" + command: ./bin/blobber --port 505${BLOBBER} --grpc_port 703${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt networks: default: testnet0: