diff --git a/Gopkg.lock b/Gopkg.lock index cfbe1eb2ad3350a5f84406bd92fa18dee8c48a59..e5baf1e4aa8e29ede358ccb68dc7c6e60f0c5dbd 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -110,6 +110,7 @@ name = "github.com/golang/protobuf" packages = [ "proto", + "protoc-gen-go/descriptor", "ptypes", "ptypes/any", "ptypes/duration", @@ -497,6 +498,8 @@ "metadata", "naming", "peer", + "reflection", + "reflection/grpc_reflection_v1alpha", "resolver", "resolver/dns", "resolver/passthrough", @@ -529,6 +532,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "449c3a942d77db009d3da12dbe9b807d6697ab68e7baaef18fbf62ebbe42cc21" + inputs-digest = "5427bb653536a3dcbc91e70991f2a1d9577d9198204fa84c73adc854d93cdf0a" solver-name = "gps-cdcl" solver-version = 1 diff --git a/account/state/memory_state.go b/account/state/memory_state.go index 368c4fa3bf849a0c4d5eaf13f7ac3ea73d0a2719..605ecd05e79425927bca321266d9227b4d28b534 100644 --- a/account/state/memory_state.go +++ b/account/state/memory_state.go @@ -13,9 +13,9 @@ type MemoryState struct { Storage map[crypto.Address]map[binary.Word256]binary.Word256 } -var _ IterableWriter = &MemoryState{} +var _ IterableReaderWriter = &MemoryState{} -// Get an in-memory state Iterable +// Get an in-memory state IterableReader func NewMemoryState() *MemoryState { return &MemoryState{ Accounts: make(map[crypto.Address]acm.Account), diff --git a/account/state/state.go b/account/state/state.go index 645462abde6c325fdf9fe7c547683eb258d34dd5..95389ad3d0a42cbd97618c7fe518a629850caf4d 100644 --- a/account/state/state.go +++ b/account/state/state.go @@ -53,26 +53,32 @@ type Reader interface { StorageGetter } -// Read and list account and storage state type Iterable interface { - Reader AccountIterable StorageIterable } -// Read and write account and storage state -type Writer interface { +// Read and list account and storage state +type IterableReader interface { + Iterable Reader +} + +type Writer interface { AccountUpdater StorageSetter } -type IterableWriter interface { +// Read and write account and storage state +type ReaderWriter interface { Reader - AccountUpdater - StorageSetter - AccountIterable - StorageIterable + Writer +} + +type IterableReaderWriter interface { + Iterable + Reader + Writer } func GetMutableAccount(getter AccountGetter, address crypto.Address) (acm.MutableAccount, error) { diff --git a/account/state/state_cache.go b/account/state/state_cache.go index a4f4c44374023fa8e4ab8448fbe0fb1d7e8e8a31..4daf768746e81a9c060358893c39114b7124a08e 100644 --- a/account/state/state_cache.go +++ b/account/state/state_cache.go @@ -222,20 +222,20 @@ func (cache *Cache) Sync(state Writer) error { } // Resets the cache to empty initialising the backing map to the same size as the previous iteration. -func (cache *Cache) Reset(backend Iterable) { +func (cache *Cache) Reset(backend Reader) { cache.Lock() defer cache.Unlock() cache.backend = backend cache.accounts = make(map[crypto.Address]*accountInfo, len(cache.accounts)) } -// Syncs the Cache and Resets it to use as the backend Reader -func (cache *Cache) Flush(state IterableWriter) error { - err := cache.Sync(state) +// Syncs the Cache to output and Resets it to use backend as Reader +func (cache *Cache) Flush(output Writer, backend Reader) error { + err := cache.Sync(output) if err != nil { return err } - cache.Reset(state) + cache.Reset(backend) return nil } diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index af8e43e413f415f74a319641e667d22c10c9d555..2d1f3553f7bd3568897f5b578622ec71e30cca32 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -39,6 +39,8 @@ type TipInfo interface { LastBlockTime() time.Time LastBlockHash() []byte AppHashAfterLastBlock() []byte + IterateValidators(iter func(publicKey crypto.PublicKey, power uint64) (stop bool)) (stopped bool) + NumValidators() int } type BlockchainInfo interface { diff --git a/consensus/tendermint/tendermint.go b/consensus/tendermint/tendermint.go index 8e9813f48a7a22fd35338708efc211c0138ea55a..e7ddf260b6622e13cdf1e30d0e9a2ec739963c59 100644 --- a/consensus/tendermint/tendermint.go +++ b/consensus/tendermint/tendermint.go @@ -9,6 +9,7 @@ import ( bcm "github.com/hyperledger/burrow/blockchain" "github.com/hyperledger/burrow/consensus/tendermint/abci" "github.com/hyperledger/burrow/event" + "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/logging" @@ -30,6 +31,8 @@ type Node struct { } } +var NewBlockQuery = query.Must(event.QueryForEventID(tm_types.EventNewBlock).Query()) + func DBProvider(ID string, backendType dbm.DBBackendType, dbDir string) dbm.DB { return dbm.NewDB(ID, backendType, dbDir) } @@ -98,18 +101,36 @@ func DeriveGenesisDoc(burrowGenesisDoc *genesis.GenesisDoc) *tm_types.GenesisDoc } } -func SubscribeNewBlock(ctx context.Context, subscribable event.Subscribable, subscriber string, - ch chan<- *tm_types.EventDataNewBlock) error { - query := event.QueryForEventID(tm_types.EventNewBlock) - - return event.SubscribeCallback(ctx, subscribable, subscriber, query, func(message interface{}) bool { - tmEventData, ok := message.(tm_types.TMEventData) +func NewBlockEvent(message interface{}) *tm_types.EventDataNewBlock { + tmEventData, ok := message.(tm_types.TMEventData) + if ok { + eventDataNewBlock, ok := tmEventData.(tm_types.EventDataNewBlock) if ok { - eventDataNewBlock, ok := tmEventData.(tm_types.EventDataNewBlock) - if ok { - ch <- &eventDataNewBlock + return &eventDataNewBlock + } + } + return nil +} + +// Subscribe to NewBlock event safely that ensures progress by a non-blocking receive as well as handling unsubscribe +func SubscribeNewBlock(ctx context.Context, subscribable event.Subscribable) (<-chan *tm_types.EventDataNewBlock, error) { + subID, err := event.GenerateSubscriptionID() + if err != nil { + return nil, err + } + const unconsumedBlocksBeforeUnsubscribe = 3 + ch := make(chan *tm_types.EventDataNewBlock, unconsumedBlocksBeforeUnsubscribe) + return ch, event.SubscribeCallback(ctx, subscribable, subID, NewBlockQuery, func(message interface{}) (stop bool) { + eventDataNewBlock := NewBlockEvent(message) + if eventDataNewBlock != nil { + select { + case ch <- eventDataNewBlock: + return false + default: + // If we can't send shut down the channel + return true } } - return true + return }) } diff --git a/core/kernel.go b/core/kernel.go index 1927df067a9b5e5297f4c0d4ca8ae89dbb0a6c78..1ea5f95b9791405126d2659c4bb5ce3e27084613 100644 --- a/core/kernel.go +++ b/core/kernel.go @@ -51,6 +51,7 @@ import ( tm_config "github.com/tendermint/tendermint/config" tm_types "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tmlibs/db" + "google.golang.org/grpc/reflection" ) const ( @@ -66,6 +67,7 @@ type Kernel struct { Service *rpc.Service Launchers []process.Launcher State *execution.State + Blockchain bcm.BlockchainInfo Logger *logging.Logger processes map[string]process.Process shutdownNotify chan struct{} @@ -248,7 +250,11 @@ func NewKernel(ctx context.Context, keyClient keys.KeyClient, privValidator tm_t pbevents.RegisterEventsServer(grpcServer, rpcevents.NewEventsServer(rpc.NewSubscriptions(service))) - pbevents.RegisterExecutionEventsServer(grpcServer, rpcevents.NewExecutionEventsServer(state)) + pbevents.RegisterExecutionEventsServer(grpcServer, rpcevents.NewExecutionEventsServer(state, emitter, + blockchain.Tip)) + + // Provides metadata about services registered + reflection.Register(grpcServer) go grpcServer.Serve(listen) @@ -266,6 +272,7 @@ func NewKernel(ctx context.Context, keyClient keys.KeyClient, privValidator tm_t Service: service, Launchers: launchers, State: state, + Blockchain: blockchain, Logger: logger, processes: make(map[string]process.Process), shutdownNotify: make(chan struct{}), diff --git a/core/kernel_test.go b/core/kernel_test.go index 0f7f0d7aa166a1f883c8ad3d1db508db0b9bda8f..be0c5106875518518a4c53cf95c4f04d465c7f35 100644 --- a/core/kernel_test.go +++ b/core/kernel_test.go @@ -77,8 +77,10 @@ func bootWaitBlocksShutdown(privValidator tmTypes.PrivValidator, genesisDoc *gen return err } - ch := make(chan *tmTypes.EventDataNewBlock) - tendermint.SubscribeNewBlock(context.Background(), kern.Emitter, "TestBootShutdownResume", ch) + ch, err := tendermint.SubscribeNewBlock(context.Background(), kern.Emitter) + if err != nil { + return err + } cont := true for cont { select { diff --git a/docs/PROPOSALS.md b/docs/PROPOSALS.md deleted file mode 100644 index fc2b5371123098c75f779e9066abea7fd6d8dd8d..0000000000000000000000000000000000000000 --- a/docs/PROPOSALS.md +++ /dev/null @@ -1,17 +0,0 @@ -# burrow proposals for future work - -The following list is extra-ordinarily uncommitted to and deliberately incomplete, but we thought it may be worthwhile sharing with you for soliciting your input and collaboration going forward: - -#### Security, Identity and Privacy - -- **Advanced security framework:** Functionality preceding Monax’s Nightsky (see multi-chain universe continuation below) to enable global encryption of transactions, genesis files and account storage at rest. -- **Identity Management and Whitelisting:** write protection is inherent to the permissioning scheme but read protection will be enabled by integrating certificates for restricting connectivity access to the peer-to-peer network for validators, verifiers or light clients. This is in addition to normal VPN and firewall solutions and a precursor of Monax’s Nightsky, which restricts read-access through selective decryption. -- **Multi-chain Universe (Step 2 of 3):** The second step towards enabling the multi-chain universe is well-underway with the Tendermint Cosmos proposal for interblockchain communication. -- **Multi-chain Universe (Step 3 of 3):** The third and final step is the Monax’s Nightsky proposal for inherent encryption of transactions and allowing only partial reconstruction of the smart contract application state for verifiers or light clients (for mobile or IoT devices). Together Cosmos and Nightsky allow smart contracts to orchestrate where information flows and who has the ability to decypher what part of the data. - -#### Scalability and Governance - -- **Read-cache Optimisation and Queryability:** subjectively pipe the application state and event logs to a data warehousing solution. Building upon the read-cache the SQLsol prototype can be integrated as an SQL-opinionated transformation layer of smart contract events and data into a relational database. -- **Chain life-cycle management:** the tooling is the starting point for chain life-cycle management and will be extended with exporting snapshots of chain state. These snapshots can be used to administratively start a new network with an updated version of burrow software as cold upgrade. In a second phase the Cosmos proposal is ideally suited to run a new version of the node software in parallel to existing chain and the validators of the network can atomically cast their vote of approval through the Cosmos hub to dynamically move the voting power over to the updated chain (hot upgrade) until a full vote of confidence is achieved. It is important to note that chain life-cycle management is complementary to and will support smart contract life-cycle management, known to some as DOUG, our marmot mascot. -- **Sharding and scalability framework:** interblockchain communication through the exchange of proofs leverages the peer-to-peer network - rather than oracles - to distribute the load across parallel chains and removes oracle-bridges as potential bottlenecks and security risks. -- **Light-client and ABI integration:** a significant usability upgrade of smart contract chains will be achieved through the ability for the ABI definition of the deployed smart contracts to be verifiably linked to the smart contract accounts. The introduction of the EIP-141 will enable the injection of an ABI fingerprint into smart contract code such that a light client, burrow-worker can dynamically expose the smart contract functionality through API calls. As an aside it is worth noting that the tendermint consensus protocol provides a distinctive advantage for light-clients as the last block signed by a majority of validators is unambiguously the current state; diff --git a/event/cache.go b/event/cache.go index 28f6babc91150512b0be4e0d64b61943d138a150..75f676cfc1333daaabd7520f5a69b68e43b68cea 100644 --- a/event/cache.go +++ b/event/cache.go @@ -21,7 +21,7 @@ type Indexable interface { var _ Publisher = &Cache{} // Create a new Cache with an EventSwitch as backend -func NewEventCache() *Cache { +func NewCache() *Cache { return &Cache{} } diff --git a/event/cache_test.go b/event/cache_test.go index 90d5e33c86496152ca93b6769ef501227c56a9cb..52bcbd6640a0f7008caf061cc504eb6cdfec00d6 100644 --- a/event/cache_test.go +++ b/event/cache_test.go @@ -19,25 +19,25 @@ func TestEventCache_Flush(t *testing.T) { flushed := false em := NewEmitter(logging.NewNoopLogger()) - SubscribeCallback(ctx, em, "nothingness", query.NewBuilder(), func(message interface{}) bool { + SubscribeCallback(ctx, em, "nothingness", query.NewBuilder(), func(message interface{}) (stop bool) { // Check against sending a buffer of zeroed messages if message == nil { errCh <- fmt.Errorf("recevied empty message but none sent") } - return false + return true }) - evc := NewEventCache() + evc := NewCache() evc.Flush(em) // Check after reset evc.Flush(em) SubscribeCallback(ctx, em, "somethingness", query.NewBuilder().AndEquals("foo", "bar"), - func(interface{}) bool { + func(interface{}) (stop bool) { if flushed { errCh <- nil - return true + return false } else { errCh <- fmt.Errorf("callback was run before messages were flushed") - return false + return true } }) @@ -62,7 +62,7 @@ func TestEventCache_Flush(t *testing.T) { func TestEventCacheGrowth(t *testing.T) { em := NewEmitter(logging.NewNoopLogger()) - evc := NewEventCache() + evc := NewCache() fireNEvents(evc, 100) c := cap(evc.events) diff --git a/event/convention.go b/event/convention.go index 5e0f9efa960e25842094609594250d9198f0ef60..dede8493bbc98eba5ada4947d3e0816d857f8714 100644 --- a/event/convention.go +++ b/event/convention.go @@ -3,6 +3,10 @@ package event import ( "context" + "time" + + "fmt" + "github.com/hyperledger/burrow/event/query" ) @@ -24,8 +28,19 @@ const ( ValueKey = "Value" GasKey = "Gas" ExceptionKey = "Exception" + LogNKeyPrefix = "Log" ) +func LogNKey(topic int) string { + return fmt.Sprintf("%s%d", LogNKeyPrefix, topic) +} + +func LogNTextKey(topic int) string { + return fmt.Sprintf("%s%dText", LogNKeyPrefix, topic) +} + +const SubscribeCallbackTimeout = 2 * time.Second + // Get a query that matches events with a specific eventID func QueryForEventID(eventID string) *query.Builder { // Since we're accepting external output here there is a chance it won't parse... @@ -33,14 +48,27 @@ func QueryForEventID(eventID string) *query.Builder { } // Subscribe to messages matching query and launch a goroutine to run a callback for each one. The goroutine will exit -// when the context is done or the subscription is removed. +// if the callback returns true for 'stop' and clean up the subscription and channel. func SubscribeCallback(ctx context.Context, subscribable Subscribable, subscriber string, queryable query.Queryable, - callback func(message interface{}) bool) error { + callback func(message interface{}) (stop bool)) error { + + out := make(chan interface{}, 1) + stopCh := make(chan bool) - out := make(chan interface{}) go func() { for msg := range out { - if !callback(msg) { + go func() { + stopCh <- callback(msg) + }() + + // Stop unless the callback returns + stop := true + select { + case stop = <-stopCh: + case <-time.After(SubscribeCallbackTimeout): + } + + if stop { // Callback is requesting stop so unsubscribe and drain channel subscribable.Unsubscribe(context.Background(), subscriber, queryable) // Not draining channel can starve other subscribers @@ -61,13 +89,13 @@ func SubscribeCallback(ctx context.Context, subscribable Subscribable, subscribe func PublishAll(ctx context.Context, subscribable Subscribable, subscriber string, queryable query.Queryable, publisher Publisher, extraTags map[string]interface{}) error { - return SubscribeCallback(ctx, subscribable, subscriber, queryable, func(message interface{}) bool { + return SubscribeCallback(ctx, subscribable, subscriber, queryable, func(message interface{}) (stop bool) { tags := make(map[string]interface{}) for k, v := range extraTags { tags[k] = v } // Help! I can't tell which tags the original publisher used - so I can't forward them on publisher.Publish(ctx, message, TagMap(tags)) - return true + return }) } diff --git a/event/convention_test.go b/event/convention_test.go index 3fa5a0401cc5a4e4c38338d717e5ba81d469e841..2fd0202dee11da929840814755b45e4f87e57842 100644 --- a/event/convention_test.go +++ b/event/convention_test.go @@ -14,10 +14,11 @@ func TestSubscribeCallback(t *testing.T) { ctx := context.Background() em := NewEmitter(logging.NewNoopLogger()) ch := make(chan interface{}) - SubscribeCallback(ctx, em, "TestSubscribeCallback", query.MatchAllQueryable(), func(msg interface{}) bool { - ch <- msg - return true - }) + SubscribeCallback(ctx, em, "TestSubscribeCallback", query.MatchAllQueryable(), + func(msg interface{}) (stop bool) { + ch <- msg + return + }) sent := "FROTHY" diff --git a/event/emitter.go b/event/emitter.go index 597cb4f13010c8b8b98dd37a7b05630230d9c5ec..1fd09e81a4a0fb5afb61bbc33b57410f4c82ddf4 100644 --- a/event/emitter.go +++ b/event/emitter.go @@ -31,10 +31,13 @@ import ( const DefaultEventBufferCapacity = 2 << 10 +// TODO: manage the creation, closing, and draining of channels behind the interface rather than only closing. +// stop one subscriber from blocking everything! type Subscribable interface { - // Subscribe to all events matching query, which is a valid tmlibs Query + // Subscribe to all events matching query, which is a valid tmlibs Query. Blocking the out channel blocks the entire + // pubsub. Subscribe(ctx context.Context, subscriber string, queryable query.Queryable, out chan<- interface{}) error - // Unsubscribe subscriber from a specific query string + // Unsubscribe subscriber from a specific query string. Note the subscribe channel must be drained. Unsubscribe(ctx context.Context, subscriber string, queryable query.Queryable) error UnsubscribeAll(ctx context.Context, subscriber string) error } @@ -43,9 +46,11 @@ type Publisher interface { Publish(ctx context.Context, message interface{}, tag Tags) error } -type PublisherFunc func(ctx context.Context, message interface{}, tags map[string]interface{}) error +var _ Publisher = PublisherFunc(nil) -func (pf PublisherFunc) Publish(ctx context.Context, message interface{}, tags map[string]interface{}) error { +type PublisherFunc func(ctx context.Context, message interface{}, tags Tags) error + +func (pf PublisherFunc) Publish(ctx context.Context, message interface{}, tags Tags) error { return pf(ctx, message, tags) } diff --git a/event/query/query.go b/event/query/query.go index a6d6969d239df2ebe010e690bec28d28e40fe403..fc107968b1541927f0c1a9f7e9edb1f9f9f9a4ae 100644 --- a/event/query/query.go +++ b/event/query/query.go @@ -36,6 +36,13 @@ type Queryable interface { // A yet-to-parsed query type String string +func Must(qry pubsub.Query, err error) Query { + if err != nil { + panic(fmt.Errorf("could not compile: %v", qry)) + } + return WrapQuery(qry) +} + func (qs String) Query() (pubsub.Query, error) { if isEmpty(string(qs)) { return query.Empty{}, nil diff --git a/event/tags.go b/event/tags.go index 00e76c0dfdfe07331c360fd8e64df67c985485ef..759d035d734b6ee4987cd1952c3b63da47373f39 100644 --- a/event/tags.go +++ b/event/tags.go @@ -8,7 +8,6 @@ import ( type Tags interface { pubsub.TagMap - Map() map[string]interface{} Keys() []string } diff --git a/execution/events/call.go b/execution/events/call.go index b174b77c95de4190b666c2b76463a3be01a5739f..23e047248756c6f4a8362af08b5dbf8bce36cb0b 100644 --- a/execution/events/call.go +++ b/execution/events/call.go @@ -24,7 +24,7 @@ import ( "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/errors" "github.com/hyperledger/burrow/txs" - "github.com/tmthrgd/go-hex" + hex "github.com/tmthrgd/go-hex" ) // Functions to generate eventId strings @@ -50,6 +50,49 @@ type CallData struct { Gas uint64 } +// Publish/Subscribe +func PublishAccountCall(publisher event.Publisher, tx *txs.Tx, height uint64, call *EventDataCall) error { + eventID := EventStringAccountCall(call.CallData.Callee) + ev := &Event{ + Header: &Header{ + TxType: tx.Type(), + TxHash: tx.Hash(), + EventType: TypeCall, + EventID: eventID, + Height: height, + }, + Call: call, + } + return publisher.Publish(context.Background(), ev, ev.Tags()) +} + +// Subscribe to account call event - if TxHash is provided listens for a specifc Tx otherwise captures all, if +// stackDepth is greater than or equal to 0 captures calls at a specific stack depth (useful for capturing the return +// of the root call over recursive calls +func SubscribeAccountCall(ctx context.Context, subscribable event.Subscribable, subscriber string, address crypto.Address, + txHash []byte, stackDepth int, ch chan<- *EventDataCall) error { + + query := event.QueryForEventID(EventStringAccountCall(address)) + + if len(txHash) > 0 { + query = query.AndEquals(event.TxHashKey, hex.EncodeUpperToString(txHash)) + } + + if stackDepth >= 0 { + query = query.AndEquals(event.StackDepthKey, stackDepth) + } + + return event.SubscribeCallback(ctx, subscribable, subscriber, query, func(message interface{}) (stop bool) { + ev, ok := message.(*Event) + if ok && ev.Call != nil { + ch <- ev.Call + } + return + }) +} + +// Tags + var callTagKeys = []string{ event.CalleeKey, event.CallerKey, @@ -88,17 +131,10 @@ func (call *EventDataCall) Len() int { return len(callTagKeys) } -func (call *EventDataCall) Map() map[string]interface{} { - tags := make(map[string]interface{}) - for _, key := range callTagKeys { - tags[key], _ = call.Get(key) - } - return tags -} - func (call *EventDataCall) Keys() []string { return callTagKeys } + func (call *EventDataCall) Tags(tags map[string]interface{}) map[string]interface{} { tags[event.CalleeKey] = call.CallData.Callee tags[event.CallerKey] = call.CallData.Caller @@ -111,44 +147,3 @@ func (call *EventDataCall) Tags(tags map[string]interface{}) map[string]interfac } return tags } - -// Publish/Subscribe -func PublishAccountCall(publisher event.Publisher, tx *txs.Tx, height uint64, call *EventDataCall) error { - eventID := EventStringAccountCall(call.CallData.Callee) - ev := &Event{ - Header: &Header{ - TxType: tx.Type(), - TxHash: tx.Hash(), - EventType: TypeCall, - EventID: eventID, - Height: height, - }, - Call: call, - } - return publisher.Publish(context.Background(), ev, ev.Tags()) -} - -// Subscribe to account call event - if TxHash is provided listens for a specifc Tx otherwise captures all, if -// stackDepth is greater than or equal to 0 captures calls at a specific stack depth (useful for capturing the return -// of the root call over recursive calls -func SubscribeAccountCall(ctx context.Context, subscribable event.Subscribable, subscriber string, address crypto.Address, - txHash []byte, stackDepth int, ch chan<- *EventDataCall) error { - - query := event.QueryForEventID(EventStringAccountCall(address)) - - if len(txHash) > 0 { - query = query.AndEquals(event.TxHashKey, hex.EncodeUpperToString(txHash)) - } - - if stackDepth >= 0 { - query = query.AndEquals(event.StackDepthKey, stackDepth) - } - - return event.SubscribeCallback(ctx, subscribable, subscriber, query, func(message interface{}) bool { - ev, ok := message.(*Event) - if ok && ev.Call != nil { - ch <- ev.Call - } - return true - }) -} diff --git a/execution/events/event.go b/execution/events/event.go index 30255c33cb22514eec73a3e6bc660b848155fd77..e5f7f5edb3773ba0608164d216bd1ebda9b8d93f 100644 --- a/execution/events/event.go +++ b/execution/events/event.go @@ -6,7 +6,6 @@ import ( "reflect" "github.com/hyperledger/burrow/event" - "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/txs" ) @@ -15,7 +14,8 @@ var cdc = txs.NewAminoCodec() var eventMessageTag = event.TagMap{event.MessageTypeKey: reflect.TypeOf(&Event{}).String()} type Provider interface { - GetEvents(startBlock, finalBlock uint64, queryable query.Queryable) (<-chan *Event, error) + GetEvents(startKey, endKey Key, consumer func(*Event) (stop bool)) (stopped bool, err error) + LatestEventKey() Key } type Event struct { @@ -35,6 +35,10 @@ func DecodeEvent(bs []byte) (*Event, error) { return ev, nil } +func (ev *Event) Key() Key { + return ev.Header.Key() +} + func (ev *Event) Encode() ([]byte, error) { return cdc.MarshalBinary(ev) } @@ -64,10 +68,6 @@ func (ev *Event) Len() int { return ev.Tags().Len() } -func (ev *Event) Map() map[string]interface{} { - return ev.Tags().Map() -} - // event.Cache will provide an index through this methods of Indexable func (ev *Event) ProvideIndex(index uint64) { ev.Header.Index = index diff --git a/execution/events/event_test.go b/execution/events/event_test.go index 562fb81775cdc99fd9d4454e2cf3077b78f1a5fc..4831edfe2760a4fcc5d2d97b2471ddfbf5bf6987 100644 --- a/execution/events/event_test.go +++ b/execution/events/event_test.go @@ -3,7 +3,12 @@ package events import ( "testing" + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/event" + "github.com/hyperledger/burrow/event/query" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/tmthrgd/go-hex" ) @@ -28,3 +33,60 @@ func TestKey_IsSuccessorOf(t *testing.T) { assert.False(t, NewKey(1, 1).IsSuccessorOf(NewKey(0, 25))) assert.True(t, NewKey(3, 0).IsSuccessorOf(NewKey(2, 0))) } + +func TestEventTagQueries(t *testing.T) { + addressHex := "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF" + address, err := crypto.AddressFromHexString(addressHex) + require.NoError(t, err) + ev := &Event{ + Header: &Header{ + EventType: TypeLog, + EventID: "foo/bar", + TxHash: []byte{2, 3, 4}, + Height: 34, + Index: 2, + }, + Log: &EventDataLog{ + Address: address, + Topics: []binary.Word256{binary.RightPadWord256([]byte("marmot"))}, + }, + } + + qb := query.NewBuilder().AndEquals(event.EventTypeKey, TypeLog.String()) + qry, err := qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + qb = qb.AndContains(event.EventIDKey, "bar") + qry, err = qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + qb = qb.AndEquals(event.TxHashKey, hex.EncodeUpperToString(ev.Header.TxHash)) + qry, err = qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + qb = qb.AndGreaterThanOrEqual(event.HeightKey, ev.Header.Height) + qry, err = qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + qb = qb.AndStrictlyLessThan(event.IndexKey, ev.Header.Index+1) + qry, err = qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + qb = qb.AndEquals(event.AddressKey, addressHex) + qry, err = qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + qb = qb.AndEquals(event.LogNTextKey(0), "marmot") + qry, err = qb.Query() + require.NoError(t, err) + assert.True(t, qry.Matches(ev)) + + t.Logf("Query: %v", qry) + t.Logf("Keys: %v", ev.Keys()) +} diff --git a/execution/events/log.go b/execution/events/log.go index 500427d695bcc516253ca7bce018c040555828ea..b41fad89fcc24db4a431e64fdf4dd8013bd8b30a 100644 --- a/execution/events/log.go +++ b/execution/events/log.go @@ -18,12 +18,15 @@ import ( "context" "fmt" + "strings" + "github.com/hyperledger/burrow/binary" . "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/txs" + "github.com/tmthrgd/go-hex" ) // Functions to generate eventId strings @@ -40,35 +43,6 @@ type EventDataLog struct { Data binary.HexBytes } -var logTagKeys = []string{event.AddressKey} - -func (log *EventDataLog) Get(key string) (string, bool) { - var value interface{} - switch key { - case event.AddressKey: - value = log.Address - default: - return "", false - } - return query.StringFromValue(value), true -} - -func (log *EventDataLog) Len() int { - return len(logTagKeys) -} - -func (log *EventDataLog) Map() map[string]interface{} { - tags := make(map[string]interface{}) - for _, key := range logTagKeys { - tags[key], _ = log.Get(key) - } - return tags -} - -func (log *EventDataLog) Keys() []string { - return logTagKeys -} - // Publish/Subscribe func PublishLogEvent(publisher event.Publisher, tx *txs.Tx, log *EventDataLog) error { ev := &Event{ @@ -87,13 +61,64 @@ func PublishLogEvent(publisher event.Publisher, tx *txs.Tx, log *EventDataLog) e func SubscribeLogEvent(ctx context.Context, subscribable event.Subscribable, subscriber string, address crypto.Address, ch chan<- *EventDataLog) error { - query := event.QueryForEventID(EventStringLogEvent(address)) + qry := event.QueryForEventID(EventStringLogEvent(address)) - return event.SubscribeCallback(ctx, subscribable, subscriber, query, func(message interface{}) bool { + return event.SubscribeCallback(ctx, subscribable, subscriber, qry, func(message interface{}) (stop bool) { ev, ok := message.(*Event) if ok && ev.Log != nil { ch <- ev.Log } - return true + return }) } + +// Tags +const logNTextTopicCutset = "\x00" + +var logTagKeys []string +var logNTopicIndex = make(map[string]int, 5) +var logNTextTopicIndex = make(map[string]int, 5) + +func init() { + for i := 0; i <= 4; i++ { + logN := event.LogNKey(i) + logTagKeys = append(logTagKeys, event.LogNKey(i)) + logNText := event.LogNTextKey(i) + logTagKeys = append(logTagKeys, logNText) + logNTopicIndex[logN] = i + logNTextTopicIndex[logNText] = i + } + logTagKeys = append(logTagKeys, event.AddressKey) +} + +func (log *EventDataLog) Get(key string) (string, bool) { + var value interface{} + switch key { + case event.AddressKey: + value = log.Address + default: + if i, ok := logNTopicIndex[key]; ok { + return hex.EncodeUpperToString(log.GetTopic(i).Bytes()), true + } + if i, ok := logNTextTopicIndex[key]; ok { + return strings.Trim(string(log.GetTopic(i).Bytes()), logNTextTopicCutset), true + } + return "", false + } + return query.StringFromValue(value), true +} + +func (log *EventDataLog) GetTopic(i int) Word256 { + if i < len(log.Topics) { + return log.Topics[i] + } + return Word256{} +} + +func (log *EventDataLog) Len() int { + return len(logTagKeys) +} + +func (log *EventDataLog) Keys() []string { + return logTagKeys +} diff --git a/execution/events/pbevents/blocks.go b/execution/events/pbevents/blocks.go index e7977b8f63d0e426e4b49ace722ff13c150c1323..5856e64b90a7e12c849da2f060400179aa70ea95 100644 --- a/execution/events/pbevents/blocks.go +++ b/execution/events/pbevents/blocks.go @@ -1,18 +1,63 @@ package pbevents -func (br *BlockRange) Bounds() (start uint64, end uint64) { - return br.GetStart().GetIndex(), br.GetEnd().GetIndex() +import "github.com/hyperledger/burrow/execution/events" + +func (br *BlockRange) Bounds(latestBlockHeight uint64) (startKey, endKey events.Key, streaming bool) { + return br.GetStart().Key(latestBlockHeight), br.GetEnd().Key(latestBlockHeight), + br.GetEnd().GetType() == Bound_STREAM +} + +func (b *Bound) Key(latestBlockHeight uint64) events.Key { + return events.NewKey(b.Bound(latestBlockHeight), 0) +} + +func (b *Bound) Bound(latestBlockHeight uint64) uint64 { + switch b.Type { + case Bound_ABSOLUTE: + return b.GetIndex() + case Bound_RELATIVE: + if b.Index < latestBlockHeight { + return latestBlockHeight - b.Index + } + return 0 + case Bound_FIRST: + return 0 + case Bound_LATEST, Bound_STREAM: + return latestBlockHeight + default: + return latestBlockHeight + } +} + +func AbsoluteBound(index uint64) *Bound { + return &Bound{ + Index: index, + Type: Bound_ABSOLUTE, + } +} + +func RelativeBound(index uint64) *Bound { + return &Bound{ + Index: index, + Type: Bound_RELATIVE, + } +} + +func LatestBound() *Bound { + return &Bound{ + Type: Bound_LATEST, + } +} + +func StreamBound() *Bound { + return &Bound{ + Type: Bound_STREAM, + } } -func SimpleBlockRange(start, end uint64) *BlockRange { +func NewBlockRange(start, end *Bound) *BlockRange { return &BlockRange{ - Start: &Bound{ - Type: Bound_ABSOLUTE, - Index: start, - }, - End: &Bound{ - Type: Bound_ABSOLUTE, - Index: end, - }, + Start: start, + End: end, } } diff --git a/execution/events/pbevents/events.go b/execution/events/pbevents/events.go index df28c3de689ac2b6330c39dec8d041c049b4a6b4..99bc841b766b8df191a7c8fe881e0431a81d5be2 100644 --- a/execution/events/pbevents/events.go +++ b/execution/events/pbevents/events.go @@ -29,7 +29,7 @@ func GetCallData(cd *events.CallData) *CallData { } } -func GetEvent(event *events.Event) *ExecutionEvent { +func GetExecutionEvent(event *events.Event) *ExecutionEvent { return &ExecutionEvent{ Header: GetEventHeader(event.Header), EventData: GetEventData(event), @@ -99,6 +99,14 @@ func (ee *ExecutionEvent) Event() *events.Event { } } +func (ee *ExecutionEvent) Key() events.Key { + return ee.Header.Key() +} + +func (h *EventHeader) Key() events.Key { + return events.NewKey(h.Height, h.Index) +} + func (h *EventHeader) Header() *events.Header { return &events.Header{ TxType: payload.TxTypeFromString(h.TxType), diff --git a/execution/events/pbevents/events.pb.go b/execution/events/pbevents/events.pb.go index ab80044f12f892c1f470304bdb99cc358cf5ffdc..085192b35d56cd6684f049367f0d912ca0ec3314 100644 --- a/execution/events/pbevents/events.pb.go +++ b/execution/events/pbevents/events.pb.go @@ -29,32 +29,36 @@ type Bound_BoundType int32 const ( // Index is absolute index of object in collection Bound_ABSOLUTE Bound_BoundType = 0 - // Index is an offset reltiave to another bound determined by context + // Index is an offset relative to another bound determined by context Bound_RELATIVE Bound_BoundType = 1 + // The first block + Bound_FIRST Bound_BoundType = 2 // Ignore provided index and evaluate to latest index - Bound_LATEST Bound_BoundType = 2 + Bound_LATEST Bound_BoundType = 3 // Ignore provided index and stream new objects as they are generated - Bound_STREAM Bound_BoundType = 3 + Bound_STREAM Bound_BoundType = 4 ) var Bound_BoundType_name = map[int32]string{ 0: "ABSOLUTE", 1: "RELATIVE", - 2: "LATEST", - 3: "STREAM", + 2: "FIRST", + 3: "LATEST", + 4: "STREAM", } var Bound_BoundType_value = map[string]int32{ "ABSOLUTE": 0, "RELATIVE": 1, - "LATEST": 2, - "STREAM": 3, + "FIRST": 2, + "LATEST": 3, + "STREAM": 4, } func (x Bound_BoundType) String() string { return proto.EnumName(Bound_BoundType_name, int32(x)) } func (Bound_BoundType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{6, 0} + return fileDescriptor_events_d44ffa1d22a15482, []int{7, 0} } // Params @@ -69,7 +73,7 @@ func (m *EventIdParam) Reset() { *m = EventIdParam{} } func (m *EventIdParam) String() string { return proto.CompactTextString(m) } func (*EventIdParam) ProtoMessage() {} func (*EventIdParam) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{0} + return fileDescriptor_events_d44ffa1d22a15482, []int{0} } func (m *EventIdParam) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventIdParam.Unmarshal(m, b) @@ -107,7 +111,7 @@ func (m *SubIdParam) Reset() { *m = SubIdParam{} } func (m *SubIdParam) String() string { return proto.CompactTextString(m) } func (*SubIdParam) ProtoMessage() {} func (*SubIdParam) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{1} + return fileDescriptor_events_d44ffa1d22a15482, []int{1} } func (m *SubIdParam) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SubIdParam.Unmarshal(m, b) @@ -146,7 +150,7 @@ func (m *EventUnSub) Reset() { *m = EventUnSub{} } func (m *EventUnSub) String() string { return proto.CompactTextString(m) } func (*EventUnSub) ProtoMessage() {} func (*EventUnSub) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{2} + return fileDescriptor_events_d44ffa1d22a15482, []int{2} } func (m *EventUnSub) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventUnSub.Unmarshal(m, b) @@ -174,17 +178,17 @@ func (m *EventUnSub) GetResult() bool { } type PollResponse struct { - Events []*ExecutionEvent `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PollResponse) Reset() { *m = PollResponse{} } func (m *PollResponse) String() string { return proto.CompactTextString(m) } func (*PollResponse) ProtoMessage() {} func (*PollResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{3} + return fileDescriptor_events_d44ffa1d22a15482, []int{3} } func (m *PollResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PollResponse.Unmarshal(m, b) @@ -204,17 +208,163 @@ func (m *PollResponse) XXX_DiscardUnknown() { var xxx_messageInfo_PollResponse proto.InternalMessageInfo -func (m *PollResponse) GetEvents() []*ExecutionEvent { +func (m *PollResponse) GetEvents() []*Event { if m != nil { return m.Events } return nil } +type Event struct { + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + // Types that are valid to be assigned to Event: + // *Event_ExecutionEvent + // *Event_TendermintEventJSON + Event isEvent_Event `protobuf_oneof:"Event"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Event) Reset() { *m = Event{} } +func (m *Event) String() string { return proto.CompactTextString(m) } +func (*Event) ProtoMessage() {} +func (*Event) Descriptor() ([]byte, []int) { + return fileDescriptor_events_d44ffa1d22a15482, []int{4} +} +func (m *Event) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Event.Unmarshal(m, b) +} +func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Event.Marshal(b, m, deterministic) +} +func (dst *Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event.Merge(dst, src) +} +func (m *Event) XXX_Size() int { + return xxx_messageInfo_Event.Size(m) +} +func (m *Event) XXX_DiscardUnknown() { + xxx_messageInfo_Event.DiscardUnknown(m) +} + +var xxx_messageInfo_Event proto.InternalMessageInfo + +type isEvent_Event interface { + isEvent_Event() +} + +type Event_ExecutionEvent struct { + ExecutionEvent *ExecutionEvent `protobuf:"bytes,2,opt,name=ExecutionEvent,proto3,oneof"` +} +type Event_TendermintEventJSON struct { + TendermintEventJSON string `protobuf:"bytes,3,opt,name=TendermintEventJSON,proto3,oneof"` +} + +func (*Event_ExecutionEvent) isEvent_Event() {} +func (*Event_TendermintEventJSON) isEvent_Event() {} + +func (m *Event) GetEvent() isEvent_Event { + if m != nil { + return m.Event + } + return nil +} + +func (m *Event) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Event) GetExecutionEvent() *ExecutionEvent { + if x, ok := m.GetEvent().(*Event_ExecutionEvent); ok { + return x.ExecutionEvent + } + return nil +} + +func (m *Event) GetTendermintEventJSON() string { + if x, ok := m.GetEvent().(*Event_TendermintEventJSON); ok { + return x.TendermintEventJSON + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{ + (*Event_ExecutionEvent)(nil), + (*Event_TendermintEventJSON)(nil), + } +} + +func _Event_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Event) + // Event + switch x := m.Event.(type) { + case *Event_ExecutionEvent: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ExecutionEvent); err != nil { + return err + } + case *Event_TendermintEventJSON: + b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeStringBytes(x.TendermintEventJSON) + case nil: + default: + return fmt.Errorf("Event.Event has unexpected type %T", x) + } + return nil +} + +func _Event_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Event) + switch tag { + case 2: // Event.ExecutionEvent + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ExecutionEvent) + err := b.DecodeMessage(msg) + m.Event = &Event_ExecutionEvent{msg} + return true, err + case 3: // Event.TendermintEventJSON + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Event = &Event_TendermintEventJSON{x} + return true, err + default: + return false, nil + } +} + +func _Event_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Event) + // Event + switch x := m.Event.(type) { + case *Event_ExecutionEvent: + s := proto.Size(x.ExecutionEvent) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Event_TendermintEventJSON: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.TendermintEventJSON))) + n += len(x.TendermintEventJSON) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + type GetEventsRequest struct { BlockRange *BlockRange `protobuf:"bytes,1,opt,name=BlockRange,proto3" json:"BlockRange,omitempty"` - BatchSize uint32 `protobuf:"varint,2,opt,name=BatchSize,proto3" json:"BatchSize,omitempty"` - Query string `protobuf:"bytes,3,opt,name=Query,proto3" json:"Query,omitempty"` + Query string `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -224,7 +374,7 @@ func (m *GetEventsRequest) Reset() { *m = GetEventsRequest{} } func (m *GetEventsRequest) String() string { return proto.CompactTextString(m) } func (*GetEventsRequest) ProtoMessage() {} func (*GetEventsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{4} + return fileDescriptor_events_d44ffa1d22a15482, []int{5} } func (m *GetEventsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetEventsRequest.Unmarshal(m, b) @@ -251,13 +401,6 @@ func (m *GetEventsRequest) GetBlockRange() *BlockRange { return nil } -func (m *GetEventsRequest) GetBatchSize() uint32 { - if m != nil { - return m.BatchSize - } - return 0 -} - func (m *GetEventsRequest) GetQuery() string { if m != nil { return m.Query @@ -276,7 +419,7 @@ func (m *GetEventsResponse) Reset() { *m = GetEventsResponse{} } func (m *GetEventsResponse) String() string { return proto.CompactTextString(m) } func (*GetEventsResponse) ProtoMessage() {} func (*GetEventsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{5} + return fileDescriptor_events_d44ffa1d22a15482, []int{6} } func (m *GetEventsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetEventsResponse.Unmarshal(m, b) @@ -315,7 +458,7 @@ func (m *Bound) Reset() { *m = Bound{} } func (m *Bound) String() string { return proto.CompactTextString(m) } func (*Bound) ProtoMessage() {} func (*Bound) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{6} + return fileDescriptor_events_d44ffa1d22a15482, []int{7} } func (m *Bound) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Bound.Unmarshal(m, b) @@ -363,7 +506,7 @@ func (m *BlockRange) Reset() { *m = BlockRange{} } func (m *BlockRange) String() string { return proto.CompactTextString(m) } func (*BlockRange) ProtoMessage() {} func (*BlockRange) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{7} + return fileDescriptor_events_d44ffa1d22a15482, []int{8} } func (m *BlockRange) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockRange.Unmarshal(m, b) @@ -419,7 +562,7 @@ func (m *EventHeader) Reset() { *m = EventHeader{} } func (m *EventHeader) String() string { return proto.CompactTextString(m) } func (*EventHeader) ProtoMessage() {} func (*EventHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{8} + return fileDescriptor_events_d44ffa1d22a15482, []int{9} } func (m *EventHeader) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventHeader.Unmarshal(m, b) @@ -497,7 +640,7 @@ func (m *ExecutionEvent) Reset() { *m = ExecutionEvent{} } func (m *ExecutionEvent) String() string { return proto.CompactTextString(m) } func (*ExecutionEvent) ProtoMessage() {} func (*ExecutionEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{9} + return fileDescriptor_events_d44ffa1d22a15482, []int{10} } func (m *ExecutionEvent) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExecutionEvent.Unmarshal(m, b) @@ -676,7 +819,7 @@ func (m *EventDataLog) Reset() { *m = EventDataLog{} } func (m *EventDataLog) String() string { return proto.CompactTextString(m) } func (*EventDataLog) ProtoMessage() {} func (*EventDataLog) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{10} + return fileDescriptor_events_d44ffa1d22a15482, []int{11} } func (m *EventDataLog) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventDataLog.Unmarshal(m, b) @@ -729,7 +872,7 @@ func (m *EventDataTx) Reset() { *m = EventDataTx{} } func (m *EventDataTx) String() string { return proto.CompactTextString(m) } func (*EventDataTx) ProtoMessage() {} func (*EventDataTx) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{11} + return fileDescriptor_events_d44ffa1d22a15482, []int{12} } func (m *EventDataTx) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventDataTx.Unmarshal(m, b) @@ -778,7 +921,7 @@ func (m *EventDataCall) Reset() { *m = EventDataCall{} } func (m *EventDataCall) String() string { return proto.CompactTextString(m) } func (*EventDataCall) ProtoMessage() {} func (*EventDataCall) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{12} + return fileDescriptor_events_d44ffa1d22a15482, []int{13} } func (m *EventDataCall) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventDataCall.Unmarshal(m, b) @@ -848,7 +991,7 @@ func (m *CallData) Reset() { *m = CallData{} } func (m *CallData) String() string { return proto.CompactTextString(m) } func (*CallData) ProtoMessage() {} func (*CallData) Descriptor() ([]byte, []int) { - return fileDescriptor_events_4b6532afacd9adee, []int{13} + return fileDescriptor_events_d44ffa1d22a15482, []int{14} } func (m *CallData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CallData.Unmarshal(m, b) @@ -908,6 +1051,7 @@ func init() { proto.RegisterType((*SubIdParam)(nil), "pbevents.SubIdParam") proto.RegisterType((*EventUnSub)(nil), "pbevents.EventUnSub") proto.RegisterType((*PollResponse)(nil), "pbevents.PollResponse") + proto.RegisterType((*Event)(nil), "pbevents.Event") proto.RegisterType((*GetEventsRequest)(nil), "pbevents.GetEventsRequest") proto.RegisterType((*GetEventsResponse)(nil), "pbevents.GetEventsResponse") proto.RegisterType((*Bound)(nil), "pbevents.Bound") @@ -1151,62 +1295,66 @@ var _ExecutionEvents_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("github.com/hyperledger/burrow/execution/events/pbevents/events.proto", fileDescriptor_events_4b6532afacd9adee) -} - -var fileDescriptor_events_4b6532afacd9adee = []byte{ - // 843 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0xae, 0xdb, 0x44, - 0x10, 0x8e, 0x8f, 0x93, 0x90, 0x4c, 0xd2, 0xd3, 0x74, 0x15, 0x8a, 0x09, 0x08, 0x05, 0x0b, 0xa4, - 0xdc, 0x34, 0xa9, 0x02, 0x12, 0x3a, 0x02, 0xb5, 0x24, 0xc4, 0x34, 0x47, 0x0a, 0x6a, 0x59, 0xbb, - 0x91, 0xe0, 0xce, 0x3f, 0xab, 0xc4, 0xaa, 0x6b, 0x9b, 0x5d, 0xbb, 0xe4, 0x20, 0xae, 0xb9, 0xe3, - 0x29, 0x78, 0x11, 0x24, 0x5e, 0x0c, 0xed, 0x8f, 0xff, 0xa2, 0x54, 0xaa, 0x7a, 0x13, 0xef, 0x37, - 0xf3, 0xed, 0x64, 0xe6, 0x9b, 0xd9, 0x5d, 0xd8, 0x1c, 0xc2, 0xec, 0x98, 0x7b, 0x73, 0x3f, 0x79, - 0xbd, 0x38, 0xde, 0xa5, 0x84, 0x46, 0x24, 0x38, 0x10, 0xba, 0xf0, 0x72, 0x4a, 0x93, 0xdf, 0x17, - 0xe4, 0x44, 0xfc, 0x3c, 0x0b, 0x93, 0x78, 0x41, 0xde, 0x90, 0x38, 0x63, 0x8b, 0xd4, 0x53, 0x0b, - 0xf9, 0x99, 0xa7, 0x34, 0xc9, 0x12, 0xd4, 0x2b, 0xcc, 0x93, 0x6f, 0xdf, 0x39, 0x1e, 0xa5, 0x09, - 0x65, 0xea, 0x23, 0xc3, 0x98, 0x33, 0x18, 0x5a, 0x3c, 0xcc, 0x6d, 0xf0, 0xc2, 0xa5, 0xee, 0x6b, - 0x64, 0xc0, 0x07, 0x44, 0x62, 0x43, 0x9b, 0x6a, 0xb3, 0x3e, 0x2e, 0xa0, 0x69, 0x02, 0xd8, 0xb9, - 0x57, 0xf0, 0xc6, 0xd0, 0x61, 0x1c, 0x29, 0x96, 0x04, 0xe6, 0x17, 0x00, 0x22, 0xda, 0xcb, 0xd8, - 0xce, 0x3d, 0xf4, 0x10, 0xba, 0x94, 0xb0, 0x3c, 0xca, 0x04, 0xa9, 0x87, 0x15, 0x32, 0xbf, 0x87, - 0xe1, 0x8b, 0x24, 0x8a, 0x30, 0x61, 0x69, 0x12, 0x33, 0x82, 0x1e, 0x43, 0x57, 0x96, 0x62, 0x68, - 0x53, 0x7d, 0x36, 0x58, 0x1a, 0xf3, 0xa2, 0xb6, 0xb9, 0x55, 0x24, 0x2f, 0xc2, 0x62, 0xc5, 0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 0x8b, 0x2b, 0x1e, 0x99, 0xe5, 0x2f, 0x70, 0xbf, 0x79, 0x6c, 0x19, 0xfa, 0x11, 0xfa, - 0xe5, 0xfd, 0x8c, 0x26, 0xd5, 0xae, 0xf3, 0x27, 0x63, 0xf2, 0xc9, 0x45, 0x9f, 0x2c, 0xec, 0xb1, - 0xb6, 0xbe, 0xf9, 0xf5, 0x9b, 0xf7, 0x7c, 0xaa, 0xbd, 0xae, 0x78, 0x5d, 0xbf, 0xfa, 0x3f, 0x00, - 0x00, 0xff, 0xff, 0x64, 0x13, 0x5b, 0x2c, 0xec, 0x07, 0x00, 0x00, + proto.RegisterFile("github.com/hyperledger/burrow/execution/events/pbevents/events.proto", fileDescriptor_events_d44ffa1d22a15482) +} + +var fileDescriptor_events_d44ffa1d22a15482 = []byte{ + // 907 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0xdc, 0x44, + 0x14, 0x5e, 0x67, 0x7f, 0x1a, 0x9f, 0x5d, 0x12, 0x77, 0x08, 0xc5, 0x04, 0x84, 0x82, 0x05, 0x22, + 0x37, 0xdd, 0xad, 0x0c, 0x52, 0x15, 0x81, 0x8a, 0x76, 0x89, 0xdb, 0x4d, 0xb5, 0x34, 0x65, 0xec, + 0x46, 0x82, 0x0b, 0x24, 0x7b, 0x3d, 0xda, 0xb5, 0xea, 0xd8, 0x66, 0xc6, 0x2e, 0x9b, 0x17, 0xe0, + 0x19, 0xb8, 0xe0, 0x8e, 0x17, 0x41, 0xe2, 0xc5, 0xd0, 0xfc, 0xf8, 0x97, 0xad, 0x54, 0x71, 0x13, + 0xcf, 0x37, 0xe7, 0x9b, 0x6f, 0xcf, 0xf9, 0xce, 0xfc, 0x04, 0x2e, 0x37, 0x51, 0xbe, 0x2d, 0x82, + 0xe9, 0x3a, 0xbd, 0x9d, 0x6d, 0xef, 0x32, 0x42, 0x63, 0x12, 0x6e, 0x08, 0x9d, 0x05, 0x05, 0xa5, + 0xe9, 0x6f, 0x33, 0xb2, 0x23, 0xeb, 0x22, 0x8f, 0xd2, 0x64, 0x46, 0xde, 0x90, 0x24, 0x67, 0xb3, + 0x2c, 0x50, 0x03, 0xf9, 0x99, 0x66, 0x34, 0xcd, 0x53, 0x74, 0x58, 0x4e, 0x9f, 0x7e, 0xf3, 0xce, + 0x7a, 0x94, 0xa6, 0x94, 0xa9, 0x8f, 0x94, 0xb1, 0xce, 0x61, 0xe2, 0x70, 0x99, 0xab, 0xf0, 0xa5, + 0x4f, 0xfd, 0x5b, 0x64, 0xc2, 0x3d, 0x22, 0xb1, 0xa9, 0x9d, 0x69, 0xe7, 0x3a, 0x2e, 0xa1, 0x65, + 0x01, 0xb8, 0x45, 0x50, 0xf2, 0x4e, 0x60, 0xc8, 0x38, 0x52, 0x2c, 0x09, 0xac, 0xcf, 0x01, 0x84, + 0xda, 0xab, 0xc4, 0x2d, 0x02, 0xf4, 0x00, 0x46, 0x94, 0xb0, 0x22, 0xce, 0x05, 0xe9, 0x10, 0x2b, + 0x64, 0x3d, 0x86, 0xc9, 0xcb, 0x34, 0x8e, 0x31, 0x61, 0x59, 0x9a, 0x30, 0x82, 0xbe, 0x84, 0x91, + 0x2c, 0xc5, 0xd4, 0xce, 0xfa, 0xe7, 0x63, 0xfb, 0x78, 0x5a, 0xd6, 0x36, 0x15, 0x6a, 0x58, 0x85, + 0xad, 0x3f, 0x35, 0x18, 0x8a, 0x19, 0x84, 0x60, 0xf0, 0xc2, 0xbf, 0x25, 0xea, 0xd7, 0xc5, 0x18, + 0x2d, 0xe0, 0xc8, 0x29, 0x6b, 0x15, 0x2c, 0xf3, 0xe0, 0x4c, 0x3b, 0x1f, 0xdb, 0x66, 0x43, 0xae, + 0x15, 0x5f, 0xf6, 0x70, 0x67, 0x05, 0xb2, 0xe1, 0x7d, 0x8f, 0x24, 0x21, 0xa1, 0xb7, 0x51, 0x92, + 0x8b, 0x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ab, 0x8b, 0x9e, 0x80, 0xa1, 0x5e, 0x2d, 0x56, 0x29, 0xec, 0xcf, 0xe0, + 0xa4, 0xa3, 0x2b, 0xde, 0x39, 0xfb, 0x27, 0x38, 0x6e, 0x1f, 0x5b, 0x86, 0x9e, 0x82, 0x5e, 0x5d, + 0xd5, 0xe8, 0xb4, 0x5e, 0xd5, 0x7d, 0x1f, 0x4e, 0x3f, 0xde, 0x1b, 0x93, 0x85, 0x3d, 0xd2, 0x16, + 0x17, 0x3f, 0x3f, 0xfe, 0x9f, 0xff, 0x2d, 0x04, 0x23, 0xf1, 0xc0, 0x7f, 0xf5, 0x6f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x6f, 0x28, 0x40, 0xd9, 0x6f, 0x08, 0x00, 0x00, } diff --git a/execution/events/pbevents/events.proto b/execution/events/pbevents/events.proto index 7912a7f553059fb9ee8e3584e78c67934e99f1e9..67cb46c39152e9ba95ab05d4539c55b80cbf803e 100644 --- a/execution/events/pbevents/events.proto +++ b/execution/events/pbevents/events.proto @@ -29,20 +29,65 @@ message EventUnSub { } message PollResponse { - repeated ExecutionEvent events = 1; + repeated Event events = 1; } -//-------------------------------------------------- -// Event dump +message Event { + string Name = 1; + oneof Event { + // Burrow's execution domain events generated deterministically from transactions + ExecutionEvent ExecutionEvent = 2; + // Operational events from tendermint serialised into their standard JSON representation + string TendermintEventJSON = 3; + } +} +//-------------------------------------------------- +// Execution events service ExecutionEvents { + // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block + // are guaranteed to be delivered in each GetEventsResponse rpc GetEvents (GetEventsRequest) returns (stream GetEventsResponse); } message GetEventsRequest { BlockRange BlockRange = 1; - uint32 BatchSize = 2; - string Query = 3; + // Specify a query on which to match the tags of events. + // Tag | Match type | Values + // ----------------------------------------- + // All events + // ----------------------------------------- + // TxType | String | "UnknownTx", "SendTx", "CallTx", "NameTx", "BondTx", "UnbondTx", "PermissionsTx", "GovernanceTx" + // TxHash | String | bytes + // EventType | String | "CallEvent", "LogEvent", "AccountInputEvent", "AccountOutputEvent" + // EventID | String | string + // Height | Integer | uint64 + // Index | Integer | uint64 + // MessageType | String | Go type name + // ----------------------------------------- + // Log event + // ----------------------------------------- + // Address | String | Address (hex) + // Log<0-4> | String | Word256 (hex) + // Log<0-4>Text | String | string (trimmed) + // ----------------------------------------- + // Call event + // ----------------------------------------- + // Origin | String | Address (hex) + // Callee | String | Address (hex) + // Caller | String | Address (hex) + // Value | Integer | uint64 + // Gas | Integer | uint64 + // StackDepth | Integer | uint64 + // Exception | String | string + // ----------------------------------------- + // Tx event (input/output) + // ----------------------------------------- + // Exception | String | string + // + // For example: + // EventType = 'LogEvent' AND EventID CONTAINS 'bar' AND TxHash = '020304' AND Height >= 34 AND Index < 3 AND Address = 'DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF' + string Query = 2; } message GetEventsResponse { @@ -55,18 +100,24 @@ message Bound { enum BoundType { // Index is absolute index of object in collection ABSOLUTE = 0; - // Index is an offset reltiave to another bound determined by context + // Index is an offset relative to another bound determined by context RELATIVE = 1; + // The first block + FIRST = 2; // Ignore provided index and evaluate to latest index - LATEST = 2; + LATEST = 3; // Ignore provided index and stream new objects as they are generated - STREAM = 3; + STREAM = 4; } } -// An inclusive range of blocks to include +// An inclusive range of blocks to include in output message BlockRange { - // How to interpret StartBlock + // Bounds can be set to: + // absolute: block height + // relative: block height counting back from latest + // latest: latest block when call is processed + // stream: for End keep sending new blocks, for start same as latest Bound Start = 1; Bound End = 2; } diff --git a/execution/events/tx.go b/execution/events/tx.go index b7d49ec9e2f8dcb8e47e470d418900d34f40788c..c1da5c62d4856d96e6d6fbdd5c1feff9d58dbc67 100644 --- a/execution/events/tx.go +++ b/execution/events/tx.go @@ -29,35 +29,6 @@ type EventDataTx struct { Exception *errors.Exception } -var txTagKeys = []string{event.ExceptionKey} - -func (tx *EventDataTx) Get(key string) (string, bool) { - var value interface{} - switch key { - case event.ExceptionKey: - value = tx.Exception - default: - return "", false - } - return query.StringFromValue(value), true -} - -func (tx *EventDataTx) Len() int { - return len(txTagKeys) -} - -func (tx *EventDataTx) Map() map[string]interface{} { - tags := make(map[string]interface{}) - for _, key := range txTagKeys { - tags[key], _ = tx.Get(key) - } - return tags -} - -func (tx *EventDataTx) Keys() []string { - return txTagKeys -} - // For re-use var sendTxQuery = query.NewBuilder(). AndEquals(event.TxTypeKey, payload.TypeSend.String()) @@ -109,16 +80,16 @@ func PublishPermissions(publisher event.Publisher, height uint64, tx *txs.Tx) er func SubscribeAccountOutputSendTx(ctx context.Context, subscribable event.Subscribable, subscriber string, address crypto.Address, txHash []byte, ch chan<- *payload.SendTx) error { - query := sendTxQuery.And(event.QueryForEventID(EventStringAccountOutput(address))). + qry := sendTxQuery.And(event.QueryForEventID(EventStringAccountOutput(address))). AndEquals(event.TxHashKey, hex.EncodeUpperToString(txHash)) - return event.SubscribeCallback(ctx, subscribable, subscriber, query, func(message interface{}) bool { + return event.SubscribeCallback(ctx, subscribable, subscriber, qry, func(message interface{}) (stop bool) { if ev, ok := message.(*Event); ok && ev.Tx != nil { if sendTx, ok := ev.Tx.Tx.Payload.(*payload.SendTx); ok { ch <- sendTx } } - return true + return }) } @@ -138,3 +109,26 @@ func txEvent(height uint64, eventType Type, eventID string, tx *txs.Tx, ret []by }, } } + +// Tags + +var txTagKeys = []string{event.ExceptionKey} + +func (tx *EventDataTx) Get(key string) (string, bool) { + var value interface{} + switch key { + case event.ExceptionKey: + value = tx.Exception + default: + return "", false + } + return query.StringFromValue(value), true +} + +func (tx *EventDataTx) Len() int { + return len(txTagKeys) +} + +func (tx *EventDataTx) Keys() []string { + return txTagKeys +} diff --git a/execution/evm/fake_app_state.go b/execution/evm/fake_app_state.go index b618a48ad5b8a8885c032d6ec7ec6ea5c87c65f1..8b1bd9ac473eedcee79134b1a33a10016bc7de09 100644 --- a/execution/evm/fake_app_state.go +++ b/execution/evm/fake_app_state.go @@ -30,7 +30,7 @@ type FakeAppState struct { storage map[string]Word256 } -var _ state.Writer = &FakeAppState{} +var _ state.ReaderWriter = &FakeAppState{} func (fas *FakeAppState) GetAccount(addr crypto.Address) (acm.Account, error) { account := fas.accounts[addr] diff --git a/execution/evm/native.go b/execution/evm/native.go index 4a7c7e615141faf3dd92b50fe4ec095d6a8cbdb4..c4577ea901995f82eeb8a5577825c70ad5cb18ec 100644 --- a/execution/evm/native.go +++ b/execution/evm/native.go @@ -56,7 +56,7 @@ func registerNativeContracts() { //----------------------------------------------------------------------------- -func ExecuteNativeContract(address Word256, state state.Writer, caller acm.Account, input []byte, gas *uint64, +func ExecuteNativeContract(address Word256, state state.ReaderWriter, caller acm.Account, input []byte, gas *uint64, logger *logging.Logger) ([]byte, errors.CodedError) { contract, ok := registeredNativeContracts[address] @@ -71,7 +71,7 @@ func ExecuteNativeContract(address Word256, state state.Writer, caller acm.Accou return output, nil } -type NativeContract func(state state.Writer, caller acm.Account, input []byte, gas *uint64, +type NativeContract func(state state.ReaderWriter, caller acm.Account, input []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) /* Removed due to C dependency @@ -98,7 +98,7 @@ OH NO STOCASTIC CAT CODING!!!! } */ -func sha256Func(state state.Writer, caller acm.Account, input []byte, gas *uint64, +func sha256Func(state state.ReaderWriter, caller acm.Account, input []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { // Deduct gas gasRequired := uint64((len(input)+31)/32)*GasSha256Word + GasSha256Base @@ -114,7 +114,7 @@ func sha256Func(state state.Writer, caller acm.Account, input []byte, gas *uint6 return hasher.Sum(nil), nil } -func ripemd160Func(state state.Writer, caller acm.Account, input []byte, gas *uint64, +func ripemd160Func(state state.ReaderWriter, caller acm.Account, input []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { // Deduct gas gasRequired := uint64((len(input)+31)/32)*GasRipemd160Word + GasRipemd160Base @@ -130,7 +130,7 @@ func ripemd160Func(state state.Writer, caller acm.Account, input []byte, gas *ui return LeftPadBytes(hasher.Sum(nil), 32), nil } -func identityFunc(state state.Writer, caller acm.Account, input []byte, gas *uint64, +func identityFunc(state state.ReaderWriter, caller acm.Account, input []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { // Deduct gas gasRequired := uint64((len(input)+31)/32)*GasIdentityWord + GasIdentityBase diff --git a/execution/evm/snative.go b/execution/evm/snative.go index 7f9c25e57ff60891305b15c58edd02fcb827aed1..234cfb1a547b18c4882a3df4c7f748daf6de77a9 100644 --- a/execution/evm/snative.go +++ b/execution/evm/snative.go @@ -230,7 +230,7 @@ func NewSNativeContract(comment, name string, // This function is designed to be called from the EVM once a SNative contract // has been selected. It is also placed in a registry by registerSNativeContracts // So it can be looked up by SNative address -func (contract *SNativeContractDescription) Dispatch(state state.Writer, caller acm.Account, +func (contract *SNativeContractDescription) Dispatch(state state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { logger = logger.With(structure.ScopeKey, "Dispatch", "contract_name", contract.Name) @@ -343,7 +343,7 @@ func abiReturn(name string, abiTypeName abi.TypeName) abi.Return { // Permission function defintions // TODO: catch errors, log em, return 0s to the vm (should some errors cause exceptions though?) -func hasBase(state state.Writer, caller acm.Account, args []byte, gas *uint64, +func hasBase(state state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { addrWord256, permNum := returnTwoArgs(args) @@ -369,7 +369,7 @@ func hasBase(state state.Writer, caller acm.Account, args []byte, gas *uint64, return LeftPadWord256([]byte{permInt}).Bytes(), nil } -func setBase(stateWriter state.Writer, caller acm.Account, args []byte, gas *uint64, +func setBase(stateWriter state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { addrWord256, permNum, permVal := returnThreeArgs(args) @@ -396,7 +396,7 @@ func setBase(stateWriter state.Writer, caller acm.Account, args []byte, gas *uin return effectivePermBytes(acc.Permissions().Base, globalPerms(stateWriter)), nil } -func unsetBase(stateWriter state.Writer, caller acm.Account, args []byte, gas *uint64, +func unsetBase(stateWriter state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { addrWord256, permNum := returnTwoArgs(args) @@ -423,7 +423,7 @@ func unsetBase(stateWriter state.Writer, caller acm.Account, args []byte, gas *u return effectivePermBytes(acc.Permissions().Base, globalPerms(stateWriter)), nil } -func setGlobal(stateWriter state.Writer, caller acm.Account, args []byte, gas *uint64, +func setGlobal(stateWriter state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { permNum, permVal := returnTwoArgs(args) @@ -449,7 +449,7 @@ func setGlobal(stateWriter state.Writer, caller acm.Account, args []byte, gas *u return permBytes(acc.Permissions().Base.ResultantPerms()), nil } -func hasRole(state state.Writer, caller acm.Account, args []byte, gas *uint64, +func hasRole(state state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { addrWord256, role := returnTwoArgs(args) @@ -470,7 +470,7 @@ func hasRole(state state.Writer, caller acm.Account, args []byte, gas *uint64, return LeftPadWord256([]byte{permInt}).Bytes(), nil } -func addRole(stateWriter state.Writer, caller acm.Account, args []byte, gas *uint64, +func addRole(stateWriter state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { addrWord256, role := returnTwoArgs(args) @@ -492,7 +492,7 @@ func addRole(stateWriter state.Writer, caller acm.Account, args []byte, gas *uin return LeftPadWord256([]byte{permInt}).Bytes(), nil } -func removeRole(stateWriter state.Writer, caller acm.Account, args []byte, gas *uint64, +func removeRole(stateWriter state.ReaderWriter, caller acm.Account, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { addrWord256, role := returnTwoArgs(args) @@ -523,7 +523,7 @@ func ValidPermN(n ptypes.PermFlag) bool { } // Get the global BasePermissions -func globalPerms(stateWriter state.Writer) ptypes.BasePermissions { +func globalPerms(stateWriter state.ReaderWriter) ptypes.BasePermissions { return state.GlobalAccountPermissions(stateWriter).Base } diff --git a/execution/evm/vm.go b/execution/evm/vm.go index 63ec863895eb56839a7898c5bc6156c01f33db10..dda39f001067077667307c895ba50cdd76cc4db1 100644 --- a/execution/evm/vm.go +++ b/execution/evm/vm.go @@ -93,7 +93,7 @@ func (vm *VM) SetPublisher(publisher event.Publisher) { // on known permissions and panics else) // If the perm is not defined in the acc nor set by default in GlobalPermissions, // this function returns false. -func HasPermission(stateWriter state.Writer, acc acm.Account, perm ptypes.PermFlag) bool { +func HasPermission(stateWriter state.ReaderWriter, acc acm.Account, perm ptypes.PermFlag) bool { value, _ := acc.Permissions().Base.Compose(state.GlobalAccountPermissions(stateWriter).Base).Get(perm) return value } diff --git a/execution/evm/vm_test.go b/execution/evm/vm_test.go index 42c205becb2e30dd9fc30dd5341c93bde9d166de..62d1ca3b816631af52709aa0eb0ea6f5eefec4db 100644 --- a/execution/evm/vm_test.go +++ b/execution/evm/vm_test.go @@ -1042,7 +1042,7 @@ func runVM(eventCh chan<- *events.EventDataCall, vmCache *state.Cache, ourVm *VM if err != nil { return nil, err } - evc := event.NewEventCache() + evc := event.NewCache() ourVm.SetPublisher(evc) start := time.Now() output, err := ourVm.Call(vmCache, caller, callee, contractCode, []byte{}, 0, &gas) diff --git a/execution/execution.go b/execution/execution.go index 897737b207f31fba440629424b862463adee1274..22eff6e9b33dc219c5ddbd90e267533a2bd2dcf8 100644 --- a/execution/execution.go +++ b/execution/execution.go @@ -39,9 +39,9 @@ type Executor interface { } type ExecutorState interface { - Update(updater func(ws Updatable)) - names.Getter - state.Iterable + Update(updater func(ws Updatable) error) (hash []byte, err error) + names.Reader + state.IterableReader } type BatchExecutor interface { @@ -78,21 +78,21 @@ type executor struct { var _ BatchExecutor = (*executor)(nil) // Wraps a cache of what is variously known as the 'check cache' and 'mempool' -func NewBatchChecker(backend ExecutorState, tip *bcm.Tip, logger *logging.Logger, +func NewBatchChecker(backend ExecutorState, tip bcm.TipInfo, logger *logging.Logger, options ...ExecutionOption) BatchExecutor { return newExecutor("CheckCache", false, backend, tip, event.NewNoOpPublisher(), logger.WithScope("NewBatchExecutor"), options...) } -func NewBatchCommitter(backend ExecutorState, tip *bcm.Tip, publisher event.Publisher, logger *logging.Logger, +func NewBatchCommitter(backend ExecutorState, tip bcm.TipInfo, publisher event.Publisher, logger *logging.Logger, options ...ExecutionOption) BatchCommitter { return newExecutor("CommitCache", true, backend, tip, publisher, logger.WithScope("NewBatchCommitter"), options...) } -func newExecutor(name string, runCall bool, backend ExecutorState, tip *bcm.Tip, publisher event.Publisher, +func newExecutor(name string, runCall bool, backend ExecutorState, tip bcm.TipInfo, publisher event.Publisher, logger *logging.Logger, options ...ExecutionOption) *executor { exe := &executor{ @@ -100,7 +100,7 @@ func newExecutor(name string, runCall bool, backend ExecutorState, tip *bcm.Tip, state: backend, publisher: publisher, stateCache: state.NewCache(backend, state.Name(name)), - eventCache: event.NewEventCache(), + eventCache: event.NewCache(), nameRegCache: names.NewCache(backend), logger: logger.With(structure.ComponentKey, "Executor"), } @@ -167,7 +167,7 @@ func (exe *executor) Execute(txEnv *txs.Envelope) (err error) { return fmt.Errorf("unknown transaction type: %v", txEnv.Tx.Type()) } -func (exe *executor) Commit() (hash []byte, err error) { +func (exe *executor) Commit() (_ []byte, err error) { // The write lock to the executor is controlled by the caller (e.g. abci.App) so we do not acquire it here to avoid // deadlock defer func() { @@ -175,36 +175,27 @@ func (exe *executor) Commit() (hash []byte, err error) { err = fmt.Errorf("recovered from panic in executor.Commit(): %v\n%v", r, debug.Stack()) } }() - exe.state.Update(func(ws Updatable) { + return exe.state.Update(func(ws Updatable) error { // flush the caches - err = exe.stateCache.Flush(ws) + err := exe.stateCache.Flush(ws, exe.state) if err != nil { - return + return err } - err = exe.nameRegCache.Flush(ws) + err = exe.nameRegCache.Flush(ws, exe.state) if err != nil { - return + return err } err = exe.eventCache.Sync(ws) if err != nil { - return - } - //save state to disk - err = ws.Save() - if err != nil { - return + return err } // flush events to listeners err = exe.eventCache.Flush(exe.publisher) if err != nil { - return + return err } - hash = ws.Hash() + return nil }) - if err != nil { - return nil, err - } - return hash, nil } func (exe *executor) Reset() error { diff --git a/execution/execution_test.go b/execution/execution_test.go index 9255bdb1b9284ad213c4b1bc382e97d3c7932381..74e5689ccf1f447032e88dd2b0eac57d09bc06c5 100644 --- a/execution/execution_test.go +++ b/execution/execution_test.go @@ -916,8 +916,9 @@ func TestTxSequence(t *testing.T) { tx.AddOutput(acc1.Address(), 1) txEnv := txs.Enclose(testChainID, tx) require.NoError(t, txEnv.Sign(privAccounts[0])) - stateCopy := state.Copy(dbm.NewMemDB()) - err := execTxWithState(stateCopy, txEnv) + stateCopy, err := state.Copy(dbm.NewMemDB()) + require.NoError(t, err) + err = execTxWithState(stateCopy, txEnv) if i == 1 { // Sequence is good. if err != nil { @@ -947,7 +948,7 @@ func TestTxSequence(t *testing.T) { func TestNameTxs(t *testing.T) { st, err := MakeGenesisState(dbm.NewMemDB(), testGenesisDoc) require.NoError(t, err) - st.writeState.Save() + st.writeState.save() names.MinNameRegistrationPeriod = 5 blockchain := newBlockchain(testGenesisDoc) @@ -1245,16 +1246,19 @@ var callerCode, _ = hex.DecodeString("60606040526000357c010000000000000000000000 var sendData, _ = hex.DecodeString("3e58c58c") func TestContractSend(t *testing.T) { - state, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) //val0 := state.GetValidatorInfo(privValidators[0].Address()) - acc0 := getAccount(state, privAccounts[0].Address()) - acc1 := getAccount(state, privAccounts[1].Address()) - acc2 := getAccount(state, privAccounts[2].Address()) + acc0 := getAccount(st, privAccounts[0].Address()) + acc1 := getAccount(st, privAccounts[1].Address()) + acc2 := getAccount(st, privAccounts[2].Address()) - newAcc1 := getAccount(state, acc1.Address()) + newAcc1 := getAccount(st, acc1.Address()) newAcc1.SetCode(callerCode) - state.writeState.UpdateAccount(newAcc1) + _, err := st.Update(func(up Updatable) error { + return up.UpdateAccount(newAcc1) + }) + require.NoError(t, err) sendData = append(sendData, acc2.Address().Word256().Bytes()...) sendAmt := uint64(10) @@ -1274,12 +1278,12 @@ func TestContractSend(t *testing.T) { txEnv := txs.Enclose(testChainID, tx) require.NoError(t, txEnv.Sign(privAccounts[0])) - err := execTxWithState(state, txEnv) + err = execTxWithState(st, txEnv) if err != nil { t.Errorf("Got error in executing call transaction, %v", err) } - acc2 = getAccount(state, acc2.Address()) + acc2 = getAccount(st, acc2.Address()) if acc2.Balance() != sendAmt+acc2Balance { t.Errorf("Value transfer from contract failed! Got %d, expected %d", acc2.Balance(), sendAmt+acc2Balance) } @@ -1293,10 +1297,11 @@ func TestMerklePanic(t *testing.T) { acc0 := getAccount(state, privAccounts[0].Address()) acc1 := getAccount(state, privAccounts[1].Address()) - state.writeState.Save() + state.writeState.save() // SendTx. { - stateSendTx := state.Copy(dbm.NewMemDB()) + stateSendTx, err := state.Copy(dbm.NewMemDB()) + require.NoError(t, err) tx := &payload.SendTx{ Inputs: []*payload.TxInput{ { @@ -1315,17 +1320,18 @@ func TestMerklePanic(t *testing.T) { txEnv := txs.Enclose(testChainID, tx) require.NoError(t, txEnv.Sign(privAccounts[0])) - err := execTxWithState(stateSendTx, txEnv) + err = execTxWithState(stateSendTx, txEnv) if err != nil { t.Errorf("Got error in executing send transaction, %v", err) } // uncomment for panic fun! - //stateSendTx.Save() + //stateSendTx.save() } // CallTx. Just runs through it and checks the transfer. See vm, rpc tests for more { - stateCallTx := state.Copy(dbm.NewMemDB()) + stateCallTx, err := state.Copy(dbm.NewMemDB()) + require.NoError(t, err) newAcc1 := getAccount(stateCallTx, acc1.Address()) newAcc1.SetCode([]byte{0x60}) stateCallTx.writeState.UpdateAccount(newAcc1) @@ -1341,12 +1347,12 @@ func TestMerklePanic(t *testing.T) { txEnv := txs.Enclose(testChainID, tx) require.NoError(t, txEnv.Sign(privAccounts[0])) - err := execTxWithState(stateCallTx, txEnv) + err = execTxWithState(stateCallTx, txEnv) if err != nil { t.Errorf("Got error in executing call transaction, %v", err) } } - state.writeState.Save() + state.writeState.save() trygetacc0 := getAccount(state, privAccounts[0].Address()) fmt.Println(trygetacc0.Address()) } @@ -1354,15 +1360,16 @@ func TestMerklePanic(t *testing.T) { // TODO: test overflows. // TODO: test for unbonding validators. func TestTxs(t *testing.T) { - state, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) //val0 := state.GetValidatorInfo(privValidators[0].Address()) - acc0 := getAccount(state, privAccounts[0].Address()) - acc1 := getAccount(state, privAccounts[1].Address()) + acc0 := getAccount(st, privAccounts[0].Address()) + acc1 := getAccount(st, privAccounts[1].Address()) // SendTx. { - stateSendTx := state.Copy(dbm.NewMemDB()) + stateSendTx, err := st.Copy(dbm.NewMemDB()) + require.NoError(t, err) tx := &payload.SendTx{ Inputs: []*payload.TxInput{ { @@ -1381,7 +1388,7 @@ func TestTxs(t *testing.T) { txEnv := txs.Enclose(testChainID, tx) require.NoError(t, txEnv.Sign(privAccounts[0])) - err := execTxWithState(stateSendTx, txEnv) + err = execTxWithState(stateSendTx, txEnv) if err != nil { t.Errorf("Got error in executing send transaction, %v", err) } @@ -1399,10 +1406,14 @@ func TestTxs(t *testing.T) { // CallTx. Just runs through it and checks the transfer. See vm, rpc tests for more { - stateCallTx := state.Copy(dbm.NewMemDB()) + stateCallTx, err := st.Copy(dbm.NewMemDB()) + require.NoError(t, err) newAcc1 := getAccount(stateCallTx, acc1.Address()) newAcc1.SetCode([]byte{0x60}) - stateCallTx.writeState.UpdateAccount(newAcc1) + _, err = stateCallTx.Update(func(up Updatable) error { + return up.UpdateAccount(newAcc1) + }) + require.NoError(t, err) tx := &payload.CallTx{ Input: &payload.TxInput{ Address: acc0.Address(), @@ -1415,7 +1426,7 @@ func TestTxs(t *testing.T) { txEnv := txs.Enclose(testChainID, tx) require.NoError(t, txEnv.Sign(privAccounts[0])) - err := execTxWithState(stateCallTx, txEnv) + err = execTxWithState(stateCallTx, txEnv) if err != nil { t.Errorf("Got error in executing call transaction, %v", err) } @@ -1430,7 +1441,7 @@ func TestTxs(t *testing.T) { acc1.Balance()+1, newAcc1.Balance()) } } - trygetacc0 := getAccount(state, privAccounts[0].Address()) + trygetacc0 := getAccount(st, privAccounts[0].Address()) fmt.Println(trygetacc0.Address()) // NameTx. @@ -1453,7 +1464,7 @@ basis, and nodes can leave and rejoin the network at will, acc proof-of-work chain as proof of what happened while they were gone ` entryAmount := uint64(10000) - stateNameTx := state + stateNameTx := st tx := &payload.NameTx{ Input: &payload.TxInput{ Address: acc0.Address(), @@ -1551,28 +1562,32 @@ proof-of-work chain as proof of what happened while they were gone ` } func TestSelfDestruct(t *testing.T) { - state, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) - acc0 := getAccount(state, privAccounts[0].Address()) + acc0 := getAccount(st, privAccounts[0].Address()) acc0PubKey := privAccounts[0].PublicKey() - acc1 := getAccount(state, privAccounts[1].Address()) - acc2 := getAccount(state, privAccounts[2].Address()) + acc1 := getAccount(st, privAccounts[1].Address()) + acc2 := getAccount(st, privAccounts[2].Address()) sendingAmount, refundedBalance, oldBalance := uint64(1), acc1.Balance(), acc2.Balance() - newAcc1 := getAccount(state, acc1.Address()) + newAcc1 := getAccount(st, acc1.Address()) // store 0x1 at 0x1, push an address, then self-destruct:) contractCode := []byte{0x60, 0x01, 0x60, 0x01, 0x55, 0x73} contractCode = append(contractCode, acc2.Address().Bytes()...) contractCode = append(contractCode, 0xff) newAcc1.SetCode(contractCode) - state.writeState.UpdateAccount(newAcc1) + _, err := st.Update(func(up Updatable) error { + require.NoError(t, up.UpdateAccount(newAcc1)) + return nil + }) + require.NoError(t, err) // send call tx with no data, cause self-destruct tx := payload.NewCallTxWithSequence(acc0PubKey, addressPtr(acc1), nil, sendingAmount, 1000, 0, acc0.Sequence()+1) // we use cache instead of execTxWithState so we can run the tx twice - exe := NewBatchCommitter(state, newBlockchain(testGenesisDoc).Tip, event.NewNoOpPublisher(), logger) + exe := NewBatchCommitter(st, newBlockchain(testGenesisDoc).Tip, event.NewNoOpPublisher(), logger) signAndExecute(t, false, exe, testChainID, tx, privAccounts[0]) // if we do it again, we won't get an error, but the self-destruct @@ -1584,13 +1599,13 @@ func TestSelfDestruct(t *testing.T) { exe.Commit() // acc2 should receive the sent funds and the contracts balance - newAcc2 := getAccount(state, acc2.Address()) + newAcc2 := getAccount(st, acc2.Address()) newBalance := sendingAmount + refundedBalance + oldBalance if newAcc2.Balance() != newBalance { t.Errorf("Unexpected newAcc2 balance. Expected %v, got %v", newAcc2.Balance(), newBalance) } - newAcc1 = getAccount(state, acc1.Address()) + newAcc1 = getAccount(st, acc1.Address()) if newAcc1 != nil { t.Errorf("Expected account to be removed") } @@ -1627,7 +1642,7 @@ func execTxWithState(state *State, txEnv *txs.Envelope) error { func commitNewBlock(state *State, blockchain *bcm.Blockchain) { blockchain.CommitBlock(blockchain.LastBlockTime().Add(time.Second), sha3.Sha3(blockchain.LastBlockHash()), - state.writeState.Hash()) + state.Hash()) } func execTxWithStateNewBlock(state *State, blockchain *bcm.Blockchain, txEnv *txs.Envelope) error { @@ -1646,7 +1661,7 @@ func makeGenesisState(numAccounts int, randBalance bool, minBalance uint64, numV if err != nil { panic(fmt.Errorf("could not make genesis state: %v", err)) } - s0.writeState.Save() + s0.writeState.save() return s0, privAccounts } diff --git a/execution/executors/call.go b/execution/executors/call.go index 06ba79865ae90bea801e19bb15ebe672ac167ef6..ce79fc5c2a6ddaecca585f3c2a21ec8761dcc4a1 100644 --- a/execution/executors/call.go +++ b/execution/executors/call.go @@ -22,7 +22,7 @@ const GasLimit = uint64(1000000) type CallContext struct { Tip blockchain.TipInfo - StateWriter state.Writer + StateWriter state.ReaderWriter EventPublisher event.Publisher RunCall bool VMOptions []func(*evm.VM) diff --git a/execution/executors/name.go b/execution/executors/name.go index a94cd149a53ad96b81f5ac070e20bf80b599ed31..658992d5331687450cf34fe524ddbde96a9f9583 100644 --- a/execution/executors/name.go +++ b/execution/executors/name.go @@ -16,9 +16,9 @@ import ( type NameContext struct { Tip blockchain.TipInfo - StateWriter state.Writer + StateWriter state.ReaderWriter EventPublisher event.Publisher - NameReg names.Writer + NameReg names.ReaderWriter Logger *logging.Logger tx *payload.NameTx } diff --git a/execution/executors/permissions.go b/execution/executors/permissions.go index 9b4f705ebd8622e853e9c2c522e411ac8ca3c2f9..0ccc62040da5a695c1ceaaac7c59074af793e9f0 100644 --- a/execution/executors/permissions.go +++ b/execution/executors/permissions.go @@ -18,7 +18,7 @@ import ( type PermissionsContext struct { Tip blockchain.TipInfo - StateWriter state.Writer + StateWriter state.ReaderWriter EventPublisher event.Publisher Logger *logging.Logger tx *payload.PermissionsTx diff --git a/execution/executors/send.go b/execution/executors/send.go index 8751497a728a8e4763f58e12a77ea64c8b588368..f7e9f752b0bfbf7ea7aaac0fa97609b987a670ad 100644 --- a/execution/executors/send.go +++ b/execution/executors/send.go @@ -14,7 +14,7 @@ import ( type SendContext struct { Tip blockchain.TipInfo - StateWriter state.Writer + StateWriter state.ReaderWriter EventPublisher event.Publisher Logger *logging.Logger tx *payload.SendTx diff --git a/execution/names/cache.go b/execution/names/cache.go index 074ff290eeba3cc401baf3a4d47a51dcd4fa02f0..7b8e060f1fa1ebe1b4095ad77c6c928598d2ef2a 100644 --- a/execution/names/cache.go +++ b/execution/names/cache.go @@ -23,7 +23,7 @@ import ( // The Cache helps prevent unnecessary IAVLTree updates and garbage generation. type Cache struct { sync.RWMutex - backend Getter + backend Reader names map[string]*nameInfo } @@ -39,7 +39,7 @@ var _ Writer = &Cache{} // Returns a Cache that wraps an underlying NameRegCacheGetter to use on a cache miss, can write to an // output Writer via Sync. // Not goroutine safe, use syncStateCache if you need concurrent access -func NewCache(backend Getter) *Cache { +func NewCache(backend Reader) *Cache { return &Cache{ backend: backend, names: make(map[string]*nameInfo), @@ -125,24 +125,24 @@ func (cache *Cache) Sync(state Writer) error { } // Resets the cache to empty initialising the backing map to the same size as the previous iteration. -func (cache *Cache) Reset(backend Getter) { +func (cache *Cache) Reset(backend Reader) { cache.Lock() defer cache.Unlock() cache.backend = backend cache.names = make(map[string]*nameInfo) } -// Syncs the Cache and Resets it to use Writer as the backend Getter -func (cache *Cache) Flush(state Writer) error { - err := cache.Sync(state) +// Syncs the Cache and Resets it to use Writer as the backend Reader +func (cache *Cache) Flush(output Writer, backend Reader) error { + err := cache.Sync(output) if err != nil { return err } - cache.Reset(state) + cache.Reset(backend) return nil } -func (cache *Cache) Backend() Getter { +func (cache *Cache) Backend() Reader { return cache.backend } diff --git a/execution/names/names.go b/execution/names/names.go index 1b088a7108cc5ff370f9365ebafb4c3f32c5ab71..1732575f0351c50e94cb80c69aead84e706bfde0 100644 --- a/execution/names/names.go +++ b/execution/names/names.go @@ -62,30 +62,34 @@ func DecodeEntry(entryBytes []byte) (*Entry, error) { return entry, nil } -type Getter interface { +type Reader interface { GetNameEntry(name string) (*Entry, error) } -type Updater interface { +type Writer interface { // Updates the name entry creating it if it does not exist UpdateNameEntry(entry *Entry) error // Remove the name entry RemoveNameEntry(name string) error } -type Writer interface { - Getter - Updater +type ReaderWriter interface { + Reader + Writer } type Iterable interface { - Getter IterateNameEntries(consumer func(*Entry) (stop bool)) (stopped bool, err error) } -type IterableWriter interface { +type IterableReader interface { + Iterable + Reader +} + +type IterableReaderWriter interface { Iterable - Updater + ReaderWriter } // base cost is "effective" number of bytes diff --git a/execution/state.go b/execution/state.go index fda93bc8520bf59a96efdecb4529dcded422e7e8..07409c436ab2cdfb3fc03cb7123e316c2213368f 100644 --- a/execution/state.go +++ b/execution/state.go @@ -25,21 +25,22 @@ import ( "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/event" - "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/events" "github.com/hyperledger/burrow/execution/names" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/permission" ptypes "github.com/hyperledger/burrow/permission/types" "github.com/tendermint/iavl" - "github.com/tendermint/tendermint/libs/pubsub" dbm "github.com/tendermint/tmlibs/db" ) const ( defaultCacheCapacity = 1024 + // Age of state versions in blocks before we remove them. This has us keeping a little over an hour's worth of blocks + // in principle we could manage with 2. Ideally we would lift this limit altogether but IAVL leaks memory on access + // to previous tree versions since it lazy loads values (nice) but gives no ability to unload them (see SaveBranch) + defaultVersionExpiry = 2048 // Version by state hash versionPrefix = "v/" @@ -58,16 +59,14 @@ var ( ) // Implements account and blockchain state -var _ state.Iterable = &State{} -var _ names.Iterable = &State{} +var _ state.IterableReader = &State{} +var _ names.IterableReader = &State{} var _ Updatable = &writeState{} type Updatable interface { - state.IterableWriter - names.IterableWriter + state.Writer + names.Writer event.Publisher - Hash() []byte - Save() error } // Wraps state to give access to writer methods @@ -77,13 +76,20 @@ type writeState struct { // Writers to state are responsible for calling State.Lock() before calling type State struct { + // Values not reassigned sync.RWMutex writeState *writeState - // High water mark for height/index - make sure we do not overwrite events - can only increase + db dbm.DB + tree *iavl.VersionedTree + logger *logging.Logger + + // Values may be reassigned (mutex protected) + // Previous version of IAVL tree for concurrent read-only access + readTree *iavl.Tree + // High water mark for height/index - make sure we do not overwrite events - should only increase eventKeyHighWatermark events.Key - db dbm.DB - tree *iavl.VersionedTree - logger *logging.Logger + // Last state hash + hash []byte } // Create a new State object @@ -145,8 +151,8 @@ func MakeGenesisState(db dbm.DB, genesisDoc *genesis.GenesisDoc) (*State, error) return nil, err } - // IAVLTrees must be persisted before copy operations. - err = s.writeState.Save() + // We need to save at least once so that readTree points at a non-working-state tree + _, err = s.writeState.save() if err != nil { return nil, err } @@ -162,9 +168,20 @@ func LoadState(db dbm.DB, hash []byte) (*State, error) { if err != nil { return nil, err } - treeVersion, err := s.tree.LoadVersion(version) + if version <= 0 { + return nil, fmt.Errorf("trying to load state from non-positive version: version %v, hash: %X", version, hash) + } + // Load previous version for readTree + treeVersion, err := s.tree.LoadVersion(version - 1) + if err != nil { + return nil, fmt.Errorf("could not load previous version of state tree: %v", version-1) + } + // Set readTree + s.readTree = s.tree.Tree() + // Load previous version for readTree + treeVersion, err = s.tree.LoadVersion(version) if err != nil { - return nil, fmt.Errorf("could not load versioned state tree") + return nil, fmt.Errorf("could not load current version of state tree: version %v, hash: %X", version, hash) } if treeVersion != version { return nil, fmt.Errorf("tried to load state version %v for state hash %X but loaded version %v", @@ -175,26 +192,34 @@ func LoadState(db dbm.DB, hash []byte) (*State, error) { // Perform updates to state whilst holding the write lock, allows a commit to hold the write lock across multiple // operations while preventing interlaced reads and writes -func (s *State) Update(updater func(up Updatable)) { +func (s *State) Update(updater func(up Updatable) error) ([]byte, error) { s.Lock() defer s.Unlock() updater(s.writeState) + return s.writeState.save() } -func (s *writeState) Save() error { - // Save state at a new version may still be orphaned before we save the version against the hash - hash, treeVersion, err := s.state.tree.SaveVersion() +func (ws *writeState) save() ([]byte, error) { + // Grab the current orphaning tree and save it for reads against committed state. Note that this tree will lazy + // load nodes from database (in-memory nodes are cleared when a version is saved - see SaveBranch in IAVL), however + // they are not cleared unless SaveBranch is called - and only LoadVersion/SaveVersion could do that which is a hack + ws.state.readTree = ws.state.tree.Tree() + + // save state at a new version may still be orphaned before we save the version against the hash + hash, treeVersion, err := ws.state.tree.SaveVersion() if err != nil { - return err + return nil, err } + // Provide a reference to load this version in the future from the state hash - s.SetVersion(hash, treeVersion) - return nil + ws.SetVersion(hash, treeVersion) + ws.state.hash = hash + return hash, err } // Get a previously saved tree version stored by state hash -func (s *writeState) GetVersion(hash []byte) (int64, error) { - versionBytes := s.state.db.Get(prefixedKey(versionPrefix, hash)) +func (ws *writeState) GetVersion(hash []byte) (int64, error) { + versionBytes := ws.state.db.Get(prefixedKey(versionPrefix, hash)) if versionBytes == nil { return -1, fmt.Errorf("could not retrieve version corresponding to state hash '%X' in database", hash) } @@ -202,33 +227,22 @@ func (s *writeState) GetVersion(hash []byte) (int64, error) { } // Set the tree version associated with a particular hash -func (s *writeState) SetVersion(hash []byte, version int64) { +func (ws *writeState) SetVersion(hash []byte, version int64) { versionBytes := make([]byte, 8) binary.PutInt64BE(versionBytes, version) - s.state.db.SetSync(prefixedKey(versionPrefix, hash), versionBytes) -} - -// Computes the state hash, also computed on save where it is returned -func (s *writeState) Hash() []byte { - return s.state.tree.Hash() + ws.state.db.SetSync(prefixedKey(versionPrefix, hash), versionBytes) } // Returns nil if account does not exist with given address. func (s *State) GetAccount(address crypto.Address) (acm.Account, error) { - s.RLock() - defer s.RUnlock() - return s.writeState.GetAccount(address) -} - -func (s *writeState) GetAccount(address crypto.Address) (acm.Account, error) { - _, accBytes := s.state.tree.Get(prefixedKey(accountsPrefix, address.Bytes())) + _, accBytes := s.readTree.Get(prefixedKey(accountsPrefix, address.Bytes())) if accBytes == nil { return nil, nil } return acm.Decode(accBytes) } -func (s *writeState) UpdateAccount(account acm.Account) error { +func (ws *writeState) UpdateAccount(account acm.Account) error { if account == nil { return fmt.Errorf("UpdateAccount passed nil account in execution.State") } @@ -240,23 +254,17 @@ func (s *writeState) UpdateAccount(account acm.Account) error { if err != nil { return err } - s.state.tree.Set(prefixedKey(accountsPrefix, account.Address().Bytes()), encodedAccount) + ws.state.tree.Set(prefixedKey(accountsPrefix, account.Address().Bytes()), encodedAccount) return nil } -func (s *writeState) RemoveAccount(address crypto.Address) error { - s.state.tree.Remove(prefixedKey(accountsPrefix, address.Bytes())) +func (ws *writeState) RemoveAccount(address crypto.Address) error { + ws.state.tree.Remove(prefixedKey(accountsPrefix, address.Bytes())) return nil } func (s *State) IterateAccounts(consumer func(acm.Account) (stop bool)) (stopped bool, err error) { - s.RLock() - defer s.RUnlock() - return s.writeState.IterateAccounts(consumer) -} - -func (s *writeState) IterateAccounts(consumer func(acm.Account) (stop bool)) (stopped bool, err error) { - stopped = s.state.tree.IterateRange(accountsStart, accountsEnd, true, func(key, value []byte) bool { + stopped = s.readTree.IterateRange(accountsStart, accountsEnd, true, func(key, value []byte) bool { var account acm.Account account, err = acm.Decode(value) if err != nil { @@ -268,36 +276,22 @@ func (s *writeState) IterateAccounts(consumer func(acm.Account) (stop bool)) (st } func (s *State) GetStorage(address crypto.Address, key binary.Word256) (binary.Word256, error) { - s.RLock() - defer s.RUnlock() - return s.writeState.GetStorage(address, key) -} - -func (s *writeState) GetStorage(address crypto.Address, key binary.Word256) (binary.Word256, error) { - _, value := s.state.tree.Get(prefixedKey(storagePrefix, address.Bytes(), key.Bytes())) + _, value := s.readTree.Get(prefixedKey(storagePrefix, address.Bytes(), key.Bytes())) return binary.LeftPadWord256(value), nil } -func (s *writeState) SetStorage(address crypto.Address, key, value binary.Word256) error { +func (ws *writeState) SetStorage(address crypto.Address, key, value binary.Word256) error { if value == binary.Zero256 { - s.state.tree.Remove(key.Bytes()) + ws.state.tree.Remove(key.Bytes()) } else { - s.state.tree.Set(prefixedKey(storagePrefix, address.Bytes(), key.Bytes()), value.Bytes()) + ws.state.tree.Set(prefixedKey(storagePrefix, address.Bytes(), key.Bytes()), value.Bytes()) } return nil } func (s *State) IterateStorage(address crypto.Address, consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error) { - s.RLock() - defer s.RUnlock() - return s.writeState.IterateStorage(address, consumer) - -} - -func (s *writeState) IterateStorage(address crypto.Address, - consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error) { - stopped = s.state.tree.IterateRange(storageStart, storageEnd, true, func(key []byte, value []byte) (stop bool) { + stopped = s.readTree.IterateRange(storageStart, storageEnd, true, func(key []byte, value []byte) (stop bool) { // Note: no left padding should occur unless there is a bug and non-words have been writte to this storage tree if len(key) != binary.Word256Length { err = fmt.Errorf("key '%X' stored for account %s is not a %v-byte word", @@ -319,70 +313,57 @@ func (s *writeState) IterateStorage(address crypto.Address, // Events // Execution events -func (s *writeState) Publish(ctx context.Context, msg interface{}, tags event.Tags) error { +func (ws *writeState) Publish(ctx context.Context, msg interface{}, tags event.Tags) error { if exeEvent, ok := msg.(*events.Event); ok { key := exeEvent.Header.Key() - if !key.IsSuccessorOf(s.state.eventKeyHighWatermark) { + if !key.IsSuccessorOf(ws.state.eventKeyHighWatermark) { return fmt.Errorf("received event with non-increasing key compared with current high watermark %v: %v", - s.state.eventKeyHighWatermark, exeEvent) + ws.state.eventKeyHighWatermark, exeEvent) } - s.state.eventKeyHighWatermark = key + ws.state.eventKeyHighWatermark = key bs, err := exeEvent.Encode() if err != nil { return err } - s.state.tree.Set(prefixedKey(eventPrefix, key), bs) + ws.state.tree.Set(eventKey(key), bs) } return nil } -func (s *State) GetEvents(startBlock, endBlock uint64, queryable query.Queryable) (<-chan *events.Event, error) { - var query pubsub.Query - var err error - query, err = queryable.Query() - if err != nil { - return nil, err - } - ch := make(chan *events.Event) - go func() { - s.RLock() - defer s.RUnlock() - // Close channel to signal end of iteration - defer close(ch) - //if endBlock == 0 { - //endBlock = s.eventKeyHighWatermark.Height() - //} - s.tree.IterateRange(eventKey(startBlock, 0), eventKey(endBlock+1, 0), true, - func(_, value []byte) bool { - exeEvent, err := events.DecodeEvent(value) - if err != nil { - s.logger.InfoMsg("error unmarshalling ExecutionEvent in GetEvents", structure.ErrorKey, err) - // stop iteration on error - return true - } - if query.Matches(exeEvent) { - ch <- exeEvent - } - return false - }) - }() - return ch, nil +func (s *State) GetEvents(startKey, endKey events.Key, consumer func(ev *events.Event) (stop bool)) (stopped bool, err error) { + return s.tree.IterateRange(eventKey(startKey), eventKey(endKey), true, + func(_, value []byte) bool { + var exeEvent *events.Event + exeEvent, err = events.DecodeEvent(value) + if err != nil { + err = fmt.Errorf("error unmarshalling ExecutionEvent in GetEvents: %v", err) + // stop iteration on error + return true + } + return consumer(exeEvent) + }), err +} + +func (s *State) Hash() []byte { + s.RLock() + defer s.RUnlock() + return s.hash +} + +func (s *State) LatestEventKey() events.Key { + s.RLock() + defer s.RUnlock() + return s.eventKeyHighWatermark } // Events //------------------------------------- // State.nameReg -var _ names.Iterable = &State{} +var _ names.IterableReader = &State{} func (s *State) GetNameEntry(name string) (*names.Entry, error) { - s.RLock() - defer s.RUnlock() - return s.writeState.GetNameEntry(name) -} - -func (s *writeState) GetNameEntry(name string) (*names.Entry, error) { - _, entryBytes := s.state.tree.Get(prefixedKey(nameRegPrefix, []byte(name))) + _, entryBytes := s.readTree.Get(prefixedKey(nameRegPrefix, []byte(name))) if entryBytes == nil { return nil, nil } @@ -391,13 +372,7 @@ func (s *writeState) GetNameEntry(name string) (*names.Entry, error) { } func (s *State) IterateNameEntries(consumer func(*names.Entry) (stop bool)) (stopped bool, err error) { - s.RLock() - defer s.RUnlock() - return s.writeState.IterateNameEntries(consumer) -} - -func (s *writeState) IterateNameEntries(consumer func(*names.Entry) (stop bool)) (stopped bool, err error) { - return s.state.tree.IterateRange(nameRegStart, nameRegEnd, true, func(key []byte, value []byte) (stop bool) { + return s.readTree.IterateRange(nameRegStart, nameRegEnd, true, func(key []byte, value []byte) (stop bool) { var entry *names.Entry entry, err = names.DecodeEntry(value) if err != nil { @@ -407,34 +382,36 @@ func (s *writeState) IterateNameEntries(consumer func(*names.Entry) (stop bool)) }), err } -func (s *writeState) UpdateNameEntry(entry *names.Entry) error { +func (ws *writeState) UpdateNameEntry(entry *names.Entry) error { bs, err := entry.Encode() if err != nil { return err } - s.state.tree.Set(prefixedKey(nameRegPrefix, []byte(entry.Name)), bs) + ws.state.tree.Set(prefixedKey(nameRegPrefix, []byte(entry.Name)), bs) return nil } -func (s *writeState) RemoveNameEntry(name string) error { - s.state.tree.Remove(prefixedKey(nameRegPrefix, []byte(name))) +func (ws *writeState) RemoveNameEntry(name string) error { + ws.state.tree.Remove(prefixedKey(nameRegPrefix, []byte(name))) return nil } // Creates a copy of the database to the supplied db -func (s *State) Copy(db dbm.DB) *State { - s.RLock() - defer s.RUnlock() +func (s *State) Copy(db dbm.DB) (*State, error) { stateCopy := NewState(db) s.tree.Iterate(func(key []byte, value []byte) bool { stateCopy.tree.Set(key, value) return false }) - return stateCopy + _, err := stateCopy.writeState.save() + if err != nil { + return nil, err + } + return stateCopy, nil } -func eventKey(height, index uint64) events.Key { - return prefixedKey(eventPrefix, events.NewKey(height, index)) +func eventKey(key events.Key) []byte { + return prefixedKey(eventPrefix, key) } func prefixedKey(prefix string, suffices ...[]byte) []byte { diff --git a/execution/state_test.go b/execution/state_test.go index 0cd3663cf5fcee6db4b343b95c8cc0c7cc87ea07..360910ba9021aa0c719b75d8b6b150833667cc23 100644 --- a/execution/state_test.go +++ b/execution/state_test.go @@ -24,7 +24,6 @@ import ( acm "github.com/hyperledger/burrow/account" "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/events" "github.com/hyperledger/burrow/execution/events/pbevents" "github.com/hyperledger/burrow/execution/evm/sha3" @@ -40,11 +39,10 @@ func TestState_UpdateAccount(t *testing.T) { s := NewState(db.NewMemDB()) account := acm.NewConcreteAccountFromSecret("Foo").MutableAccount() account.MutablePermissions().Base.Perms = permission.SetGlobal | permission.HasRole - var err error - s.Update(func(ws Updatable) { - err = ws.UpdateAccount(account) - err = ws.Save() + _, err := s.Update(func(ws Updatable) error { + return ws.UpdateAccount(account) }) + require.NoError(t, err) require.NoError(t, err) accountOut, err := s.GetAccount(account.Address()) @@ -59,31 +57,36 @@ func TestState_Publish(t *testing.T) { mkEvent(100, 0), mkEvent(100, 1), } - s.Update(func(ws Updatable) { + _, err := s.Update(func(ws Updatable) error { for _, ev := range evs { require.NoError(t, ws.Publish(ctx, ev, nil)) } + return nil }) + require.NoError(t, err) i := 0 - ch, err := s.GetEvents(100, 100, query.Empty{}) + _, err = s.GetEvents(events.NewKey(100, 0), events.NewKey(100, 0), + func(ev *events.Event) (stop bool) { + assert.Equal(t, evs[i], ev) + i++ + return false + }) require.NoError(t, err) - for ev := range ch { - assert.Equal(t, evs[i], ev) - i++ - } // non-increasing events - s.Update(func(ws Updatable) { + _, err = s.Update(func(ws Updatable) error { require.Error(t, ws.Publish(ctx, mkEvent(100, 0), nil)) require.Error(t, ws.Publish(ctx, mkEvent(100, 1), nil)) require.Error(t, ws.Publish(ctx, mkEvent(99, 1324234), nil)) require.NoError(t, ws.Publish(ctx, mkEvent(100, 2), nil)) require.NoError(t, ws.Publish(ctx, mkEvent(101, 0), nil)) + return nil }) + require.NoError(t, err) } func TestProtobufEventSerialisation(t *testing.T) { ev := mkEvent(112, 23) - pbEvent := pbevents.GetEvent(ev) + pbEvent := pbevents.GetExecutionEvent(ev) bs, err := proto.Marshal(pbEvent) require.NoError(t, err) pbEventOut := new(pbevents.ExecutionEvent) diff --git a/rpc/grpc.go b/rpc/grpc.go index eb9ec8dd106bf8f34804010ec78981f32b484a46..a30bdad14dd20607bdaaf04f31cee111e349f778 100644 --- a/rpc/grpc.go +++ b/rpc/grpc.go @@ -20,13 +20,15 @@ func unaryInterceptor(logger *logging.Logger) grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { + logger = logger.With("method", info.FullMethod) + defer func() { if r := recover(); r != nil { - logger.InfoMsg("panic in GRPC unary call", "method", info.FullMethod, - structure.ErrorKey, fmt.Sprintf("%v", r)) + logger.InfoMsg("panic in GRPC unary call", structure.ErrorKey, fmt.Sprintf("%v", r)) err = fmt.Errorf("panic in GRPC unary call %s: %v", info.FullMethod, r) } }() + logger.TraceMsg("GRPC unary call") return handler(ctx, req) } } @@ -34,15 +36,17 @@ func unaryInterceptor(logger *logging.Logger) grpc.UnaryServerInterceptor { func streamInterceptor(logger *logging.Logger) grpc.StreamServerInterceptor { return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error) { + logger = logger.With("method", info.FullMethod, + "is_client_stream", info.IsClientStream, + "is_server_stream", info.IsServerStream) defer func() { if r := recover(); r != nil { - logger.InfoMsg("panic in GRPC stream", "method", info.FullMethod, - "is_client_stream", info.IsClientStream, "is_server_stream", info.IsServerStream, - structure.ErrorKey, fmt.Sprintf("%v", r)) + logger.InfoMsg("panic in GRPC stream", structure.ErrorKey, fmt.Sprintf("%v", r)) err = fmt.Errorf("panic in GRPC stream %s: %v: %s", info.FullMethod, r, debug.Stack()) } }() + logger.TraceMsg("GRPC stream call") return handler(srv, ss) } } diff --git a/rpc/result.go b/rpc/result.go index bcf23863bc2e18dd4cc0dd1d0fb5aaa59a65f4d2..3159690e33135a908f76daa1e93402f2228f9e6a 100644 --- a/rpc/result.go +++ b/rpc/result.go @@ -23,6 +23,7 @@ import ( "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution" "github.com/hyperledger/burrow/execution/events" + "github.com/hyperledger/burrow/execution/events/pbevents" "github.com/hyperledger/burrow/execution/names" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/txs" @@ -258,3 +259,25 @@ func NewResultEvent(event string, eventData interface{}) (*ResultEvent, error) { } return res, nil } + +func (re *ResultEvent) GetEvent() (*pbevents.Event, error) { + ev := &pbevents.Event{ + Name: re.Event, + } + if re.Tendermint != nil { + bs, err := json.Marshal(re.Tendermint) + if err != nil { + return nil, err + } + ev.Event = &pbevents.Event_TendermintEventJSON{ + TendermintEventJSON: string(bs), + } + } else if re.Execution != nil { + ev.Event = &pbevents.Event_ExecutionEvent{ + ExecutionEvent: pbevents.GetExecutionEvent(re.Execution), + } + } else { + return nil, fmt.Errorf("ResultEvent is empty") + } + return ev, nil +} diff --git a/rpc/rpcevents/events_server.go b/rpc/rpcevents/events_server.go index 6e55d39177831a686f1e3b49d1d0f0f3be565464..699edcbff002a9ab6901b735d9c03344ac5f9b78 100644 --- a/rpc/rpcevents/events_server.go +++ b/rpc/rpcevents/events_server.go @@ -1,7 +1,6 @@ package rpcevents import ( - "github.com/hyperledger/burrow/execution/events" "github.com/hyperledger/burrow/execution/events/pbevents" "github.com/hyperledger/burrow/rpc" "golang.org/x/net/context" @@ -23,11 +22,15 @@ func (es *eventServer) EventPoll(ctx context.Context, param *pbevents.SubIdParam return nil, err } resp := &pbevents.PollResponse{ - Events: make([]*pbevents.ExecutionEvent, 0, len(msgs)), + Events: make([]*pbevents.Event, 0, len(msgs)), } for _, msg := range msgs { - if exeEvent, ok := msg.(*events.Event); ok { - resp.Events = append(resp.Events, pbevents.GetEvent(exeEvent)) + if resultEvent, ok := msg.(*rpc.ResultEvent); ok { + ev, err := resultEvent.GetEvent() + if err != nil { + return nil, err + } + resp.Events = append(resp.Events, ev) } } return resp, nil diff --git a/rpc/rpcevents/execution_events_server.go b/rpc/rpcevents/execution_events_server.go index 45794d5607a74adb93a2af7d6b74835241f240ca..57645b8bb4cd6daeba49107ac3ee4b8ccddcfa72 100644 --- a/rpc/rpcevents/execution_events_server.go +++ b/rpc/rpcevents/execution_events_server.go @@ -1,42 +1,111 @@ package rpcevents import ( + "fmt" + + "context" + + bcm "github.com/hyperledger/burrow/blockchain" + "github.com/hyperledger/burrow/consensus/tendermint" + "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/events" "github.com/hyperledger/burrow/execution/events/pbevents" + "github.com/tendermint/tendermint/libs/pubsub" ) type executionEventsServer struct { eventsProvider events.Provider + emitter event.Emitter + tip bcm.TipInfo } -func NewExecutionEventsServer(eventsProvider events.Provider) pbevents.ExecutionEventsServer { - return &executionEventsServer{eventsProvider: eventsProvider} +func NewExecutionEventsServer(eventsProvider events.Provider, emitter event.Emitter, + tip bcm.TipInfo) pbevents.ExecutionEventsServer { + + return &executionEventsServer{ + eventsProvider: eventsProvider, + emitter: emitter, + tip: tip, + } } -func (ees executionEventsServer) GetEvents(request *pbevents.GetEventsRequest, +func (ees *executionEventsServer) GetEvents(request *pbevents.GetEventsRequest, stream pbevents.ExecutionEvents_GetEventsServer) error { - buf := new(pbevents.GetEventsResponse) - blockRange := request.GetBlockRange() - batchSize := request.GetBatchSize() - start, end := blockRange.Bounds() - ch, err := ees.eventsProvider.GetEvents(start, end, query.NewBuilder(request.Query)) + start, end, streaming := blockRange.Bounds(ees.tip.LastBlockHeight()) + qry, err := query.NewBuilder(request.Query).Query() + if err != nil { + return fmt.Errorf("could not parse event query: %v", err) + } + + if !streaming { + return ees.steamEvents(stream, start, end, 1, qry) + } + + // Streaming + if err != nil { + return err + } + + out, err := tendermint.SubscribeNewBlock(context.Background(), ees.emitter) if err != nil { return err } - for ev := range ch { - buf.Events = append(buf.Events, pbevents.GetEvent(ev)) - if batchSize == 0 || uint32(len(buf.Events))%batchSize == 0 { - err := stream.Send(buf) - if err != nil { - return err + + for newBlock := range out { + if newBlock == nil { + return fmt.Errorf("received non-new-block event when subscribed with query") + } + if newBlock.Block == nil { + return fmt.Errorf("new block contains no block info: %v", newBlock) + } + height := uint64(newBlock.Block.Height) + start = end + end = events.NewKey(height, 0) + err := ees.steamEvents(stream, start, end, 1, qry) + if err != nil { + return err + } + } + + return nil +} + +func (ees *executionEventsServer) steamEvents(stream pbevents.ExecutionEvents_GetEventsServer, start, end events.Key, + batchSize uint64, qry pubsub.Query) error { + + var streamErr error + buf := new(pbevents.GetEventsResponse) + + batchStart := start.Height() + _, err := ees.eventsProvider.GetEvents(start, end, func(ev *events.Event) (stop bool) { + if qry.Matches(ev) { + // Start a new batch, flush the last lot + if ev.Header.Index == 0 && (ev.Header.Height-batchStart)%batchSize == 0 { + streamErr = flush(stream, buf) + if streamErr != nil { + return true + } + batchStart = ev.Header.Height + buf = new(pbevents.GetEventsResponse) } - buf = new(pbevents.GetEventsResponse) + buf.Events = append(buf.Events, pbevents.GetExecutionEvent(ev)) } + return false + }) + if err != nil { + return err } + if streamErr != nil { + return streamErr + } + // Flush any remaining events not filling batchSize many blocks + return flush(stream, buf) +} +func flush(stream pbevents.ExecutionEvents_GetEventsServer, buf *pbevents.GetEventsResponse) error { if len(buf.Events) > 0 { err := stream.Send(buf) if err != nil { diff --git a/rpc/rpcevents/integration/events_server_test.go b/rpc/rpcevents/integration/events_server_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7c5e471573c4503ba8cfe0b149f4c6f164d778cb --- /dev/null +++ b/rpc/rpcevents/integration/events_server_test.go @@ -0,0 +1,81 @@ +// +build integration + +// Space above here matters +// Copyright 2017 Monax Industries Limited +// +// 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. + +package integration + +import ( + "context" + "testing" + + "github.com/hyperledger/burrow/execution/pbtransactor" + "github.com/hyperledger/burrow/rpc/test" + "github.com/stretchr/testify/require" + "github.com/tmthrgd/go-hex" +) + +func TestEventSubscribe(t *testing.T) { + //cli := test.NewEventsClient(t) + //sub, err := cli.EventSubscribe(context.Background(), &pbevents.EventIdParam{ + // EventId: tmTypes.EventNewBlock, + //}) + //require.NoError(t, err) + //defer cli.EventUnsubscribe(context.Background(), sub) + // + //pollCh := make(chan *pbevents.PollResponse) + //go func() { + // poll := new(pbevents.PollResponse) + // for len(poll.Events) == 0 { + // poll, err = cli.EventPoll(context.Background(), sub) + // require.NoError(t, err) + // time.Sleep(1) + // } + // pollCh <- poll + //}() + //select { + //case poll := <-pollCh: + // require.True(t, len(poll.Events) > 0, "event poll should return at least 1 event") + // tendermintEvent := new(rpc.TendermintEvent) + // tendermintEventJSON := poll.Events[0].GetTendermintEventJSON() + // require.NoError(t, json.Unmarshal([]byte(tendermintEventJSON), tendermintEvent)) + // newBlock, ok := tendermintEvent.TMEventData.(tmTypes.EventDataNewBlock) + // require.True(t, ok, "new block event expected") + // assert.Equal(t, genesisDoc.ChainID(), newBlock.Block.ChainID) + //case <-time.After(3 * time.Second): + // t.Fatal("timed out waiting for poll event") + //} +} + +func testEventsCall(t *testing.T, numTxs int) { + cli := test.NewTransactorClient(t) + + bc, err := hex.DecodeString(test.StrangeLoopByteCode) + + require.NoError(t, err) + + countCh := test.CommittedTxCount(t, kern.Emitter) + for i := 0; i < numTxs; i++ { + _, err := cli.Transact(context.Background(), &pbtransactor.TransactParam{ + InputAccount: inputAccount, + Address: nil, + Data: bc, + Fee: 2, + GasLimit: 10000, + }) + require.NoError(t, err) + } + require.Equal(t, numTxs, <-countCh) +} diff --git a/rpc/rpcevents/integration/execution_events_server_test.go b/rpc/rpcevents/integration/execution_events_server_test.go index a5ffcd44a539b60d3e302d9dd256cf7e3047a599..cdd80b1df22a6c3e48de046f84dc0fd0a21762c0 100644 --- a/rpc/rpcevents/integration/execution_events_server_test.go +++ b/rpc/rpcevents/integration/execution_events_server_test.go @@ -29,35 +29,59 @@ import ( "github.com/hyperledger/burrow/execution/events/pbevents" "github.com/hyperledger/burrow/execution/pbtransactor" "github.com/hyperledger/burrow/rpc/test" + "github.com/hyperledger/burrow/txs/payload" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -var committedTxCountIndex = 0 -var inputAccount = &pbtransactor.InputAccount{Address: privateAccounts[0].Address().Bytes()} - -func TestSend(t *testing.T) { +func TestExecutionEventsSendStream(t *testing.T) { + request := &pbevents.GetEventsRequest{ + BlockRange: pbevents.NewBlockRange(pbevents.LatestBound(), pbevents.StreamBound()), + } tcli := test.NewTransactorClient(t) - numSends := 1500 - countCh := test.CommittedTxCount(t, kern.Emitter, &committedTxCountIndex) + ecli := test.NewExecutionEventsClient(t) + stream, err := ecli.GetEvents(context.Background(), request) + require.NoError(t, err) + numSends := 1 for i := 0; i < numSends; i++ { - send, err := tcli.Send(context.Background(), &pbtransactor.SendParam{ - InputAccount: inputAccount, - Amount: 2003, - ToAddress: privateAccounts[3].Address().Bytes(), - }) + doSends(t, 2, tcli) + response, err := stream.Recv() require.NoError(t, err) - assert.Equal(t, false, send.CreatesContract) + require.Len(t, response.Events, 4, "expect multiple events") + assert.Equal(t, payload.TypeSend.String(), response.Events[0].GetHeader().GetTxType()) + assert.Equal(t, payload.TypeSend.String(), response.Events[1].GetHeader().GetTxType()) } - require.Equal(t, numSends, <-countCh) + require.NoError(t, stream.CloseSend()) +} + +func TestExecutionEventsSend(t *testing.T) { + request := &pbevents.GetEventsRequest{ + BlockRange: pbevents.NewBlockRange(pbevents.AbsoluteBound(kern.Blockchain.LastBlockHeight()), + pbevents.AbsoluteBound(300)), + } + numSends := 1100 + responses := testExecutionEventsSend(t, numSends, request) + assert.Equal(t, numSends*2, totalEvents(responses), "should receive and input and output event per send") +} + +func TestExecutionEventsSendFiltered(t *testing.T) { + request := &pbevents.GetEventsRequest{ + BlockRange: pbevents.NewBlockRange(pbevents.AbsoluteBound(kern.Blockchain.LastBlockHeight()), + pbevents.AbsoluteBound(300)), + Query: query.NewBuilder().AndEquals(event.EventTypeKey, events.TypeAccountInput.String()).String(), + } + numSends := 500 + responses := testExecutionEventsSend(t, numSends, request) + assert.Equal(t, numSends, totalEvents(responses), "should receive a single input event per send") +} +func testExecutionEventsSend(t *testing.T, numSends int, request *pbevents.GetEventsRequest) []*pbevents.GetEventsResponse { + doSends(t, numSends, test.NewTransactorClient(t)) ecli := test.NewExecutionEventsClient(t) - evs, err := ecli.GetEvents(context.Background(), &pbevents.GetEventsRequest{ - BlockRange: pbevents.SimpleBlockRange(0, 100), - }) + evs, err := ecli.GetEvents(context.Background(), request) require.NoError(t, err) - i := 0 + var responses []*pbevents.GetEventsResponse for { resp, err := evs.Recv() if err != nil { @@ -66,21 +90,15 @@ func TestSend(t *testing.T) { } require.NoError(t, err) } - for _, ev := range resp.Events { - assert.Len(t, ev.Header.TxHash, 20) - i++ - } + responses = append(responses, resp) } - // Input/output events for each - assert.Equal(t, numSends*2, i) + return responses } -func TestSendFiltered(t *testing.T) { - tcli := test.NewTransactorClient(t) - numSends := 1500 - countCh := test.CommittedTxCount(t, kern.Emitter, &committedTxCountIndex) +func doSends(t *testing.T, numSends int, cli pbtransactor.TransactorClient) { + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numSends; i++ { - send, err := tcli.Send(context.Background(), &pbtransactor.SendParam{ + send, err := cli.Send(context.Background(), &pbtransactor.SendParam{ InputAccount: inputAccount, Amount: 2003, ToAddress: privateAccounts[3].Address().Bytes(), @@ -89,28 +107,12 @@ func TestSendFiltered(t *testing.T) { assert.Equal(t, false, send.CreatesContract) } require.Equal(t, numSends, <-countCh) +} - ecli := test.NewExecutionEventsClient(t) - - evs, err := ecli.GetEvents(context.Background(), &pbevents.GetEventsRequest{ - BlockRange: pbevents.SimpleBlockRange(0, 100), - Query: query.NewBuilder().AndEquals(event.EventTypeKey, events.TypeAccountInput.String()).String(), - }) - require.NoError(t, err) +func totalEvents(respones []*pbevents.GetEventsResponse) int { i := 0 - for { - resp, err := evs.Recv() - if err != nil { - if err == io.EOF { - break - } - require.NoError(t, err) - } - for _, ev := range resp.Events { - assert.Len(t, ev.Header.TxHash, 20) - i++ - } + for _, resp := range respones { + i += len(resp.Events) } - // Should only get input events - assert.Equal(t, numSends, i) + return i } diff --git a/rpc/rpcevents/integration/main_test.go b/rpc/rpcevents/integration/main_test.go index a83a08b5158c70bc5236c3a042e1e6ceab4eb827..338b533457def710c8e5d9e6895a8606d8d49c97 100644 --- a/rpc/rpcevents/integration/main_test.go +++ b/rpc/rpcevents/integration/main_test.go @@ -24,10 +24,12 @@ import ( "github.com/hyperledger/burrow/core" "github.com/hyperledger/burrow/core/integration" + "github.com/hyperledger/burrow/execution/pbtransactor" ) var privateAccounts = integration.MakePrivateAccounts(5) // make keys var genesisDoc = integration.TestGenesisDoc(privateAccounts) +var inputAccount = &pbtransactor.InputAccount{Address: privateAccounts[0].Address().Bytes()} var kern *core.Kernel // Needs to be in a _test.go file to be picked up diff --git a/rpc/rpctransactor/integration/transactor_server_test.go b/rpc/rpctransactor/integration/transactor_server_test.go index b970f85c31d223f9a6c0e96416ed916fa8a6f9fd..9eb2ca6ba47d5dbb7474d9c98a66d679686b25af 100644 --- a/rpc/rpctransactor/integration/transactor_server_test.go +++ b/rpc/rpctransactor/integration/transactor_server_test.go @@ -20,19 +20,16 @@ package integration import ( "context" "encoding/hex" - "fmt" "sync" "testing" "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/execution/pbtransactor" "github.com/hyperledger/burrow/rpc" "github.com/hyperledger/burrow/rpc/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/types" "google.golang.org/grpc" ) @@ -43,7 +40,7 @@ func TestTransactCallNoCode(t *testing.T) { toAddress := privateAccounts[2].Address() numCreates := 1000 - countCh := committedTxCount(t) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numCreates; i++ { receipt, err := cli.Transact(context.Background(), &pbtransactor.TransactParam{ InputAccount: inputAccount(i), @@ -68,7 +65,7 @@ func TestTransactCreate(t *testing.T) { // Flip flops between sending private key and input address to test private key and address based signing bc, err := hex.DecodeString(test.StrangeLoopByteCode) require.NoError(t, err) - countCh := committedTxCount(t) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numGoroutines; i++ { go func() { for j := 0; j < numCreates; j++ { @@ -114,7 +111,7 @@ func TestTransactAndHold(t *testing.T) { require.NoError(t, err) numGoroutines := 5 numRuns := 2 - countCh := committedTxCount(t) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numGoroutines; i++ { for j := 0; j < numRuns; j++ { create, err := cli.TransactAndHold(context.Background(), &pbtransactor.TransactParam{ @@ -146,7 +143,7 @@ func TestTransactAndHold(t *testing.T) { func TestSend(t *testing.T) { cli := newClient(t) numSends := 1000 - countCh := committedTxCount(t) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numSends; i++ { send, err := cli.Send(context.Background(), &pbtransactor.SendParam{ InputAccount: inputAccount(i), @@ -179,38 +176,6 @@ func newClient(t testing.TB) pbtransactor.TransactorClient { return pbtransactor.NewTransactorClient(conn) } -var committedTxCountIndex = 0 - -func committedTxCount(t *testing.T) chan int { - var numTxs int64 - emptyBlocks := 0 - maxEmptyBlocks := 2 - outCh := make(chan int) - ch := make(chan *types.EventDataNewBlock) - ctx := context.Background() - subscriber := fmt.Sprintf("committedTxCount_%v", committedTxCountIndex) - committedTxCountIndex++ - require.NoError(t, tendermint.SubscribeNewBlock(ctx, kern.Emitter, subscriber, ch)) - - go func() { - for ed := range ch { - if ed.Block.NumTxs == 0 { - emptyBlocks++ - } else { - emptyBlocks = 0 - } - if emptyBlocks > maxEmptyBlocks { - break - } - numTxs += ed.Block.NumTxs - t.Logf("Total TXs committed at block %v: %v (+%v)\n", ed.Block.Height, numTxs, ed.Block.NumTxs) - } - require.NoError(t, kern.Emitter.UnsubscribeAll(ctx, subscriber)) - outCh <- int(numTxs) - }() - return outCh -} - var inputPrivateKey = privateAccounts[0].PrivateKey().RawBytes() var inputAddress = privateAccounts[0].Address().Bytes() diff --git a/rpc/service.go b/rpc/service.go index dab10524d4d88570b4e7eaa365f5bea2232b4a1f..81afee6098b3b6b0f40eb08b48f2421400e84a6a 100644 --- a/rpc/service.go +++ b/rpc/service.go @@ -45,18 +45,18 @@ const AccountsRingMutexCount = 100 // Base service that provides implementation for all underlying RPC methods type Service struct { ctx context.Context - state state.Iterable - nameReg names.Iterable + state state.IterableReader + nameReg names.IterableReader mempoolAccounts *execution.Accounts subscribable event.Subscribable - blockchain *bcm.Blockchain + blockchain bcm.BlockchainInfo transactor *execution.Transactor nodeView *query.NodeView logger *logging.Logger } -func NewService(ctx context.Context, state state.Iterable, nameReg names.Iterable, - checker state.Reader, subscribable event.Subscribable, blockchain *bcm.Blockchain, keyClient keys.KeyClient, +func NewService(ctx context.Context, state state.IterableReader, nameReg names.IterableReader, + checker state.Reader, subscribable event.Subscribable, blockchain bcm.BlockchainInfo, keyClient keys.KeyClient, transactor *execution.Transactor, nodeView *query.NodeView, logger *logging.Logger) *Service { return &Service{ @@ -124,7 +124,7 @@ func (s *Service) ListUnconfirmedTxs(maxTxs int) (*ResultListUnconfirmedTxs, err } func (s *Service) Subscribe(ctx context.Context, subscriptionID string, eventID string, - callback func(resultEvent *ResultEvent) bool) error { + callback func(resultEvent *ResultEvent) (stop bool)) error { queryBuilder := event.QueryForEventID(eventID) s.logger.InfoMsg("Subscribing to events", @@ -132,14 +132,14 @@ func (s *Service) Subscribe(ctx context.Context, subscriptionID string, eventID "subscription_id", subscriptionID, "event_id", eventID) return event.SubscribeCallback(ctx, s.subscribable, subscriptionID, queryBuilder, - func(message interface{}) bool { + func(message interface{}) (stop bool) { resultEvent, err := NewResultEvent(eventID, message) if err != nil { s.logger.InfoMsg("Received event that could not be mapped to ResultEvent", structure.ErrorKey, err, "subscription_id", subscriptionID, "event_id", eventID) - return true + return false } return callback(resultEvent) }) @@ -156,8 +156,7 @@ func (s *Service) Unsubscribe(ctx context.Context, subscriptionID string) error } func (s *Service) Status() (*ResultStatus, error) { - tip := s.blockchain.Tip - latestHeight := tip.LastBlockHeight() + latestHeight := s.blockchain.LastBlockHeight() var ( latestBlockMeta *tm_types.BlockMeta latestBlockHash []byte @@ -246,7 +245,7 @@ func (s *Service) ListAccounts(predicate func(acm.Account) bool) (*ResultListAcc }) return &ResultListAccounts{ - BlockHeight: s.blockchain.Tip.LastBlockHeight(), + BlockHeight: s.blockchain.LastBlockHeight(), Accounts: accounts, }, nil } @@ -340,7 +339,7 @@ func (s *Service) ListNames(predicate func(*names.Entry) bool) (*ResultListNames return }) return &ResultListNames{ - BlockHeight: s.blockchain.Tip.LastBlockHeight(), + BlockHeight: s.blockchain.LastBlockHeight(), Names: nms, }, nil } @@ -358,7 +357,7 @@ func (s *Service) GetBlock(height uint64) (*ResultGetBlock, error) { // Passing 0 for maxHeight sets the upper height of the range to the current // blockchain height. func (s *Service) ListBlocks(minHeight, maxHeight uint64) (*ResultListBlocks, error) { - latestHeight := s.blockchain.Tip.LastBlockHeight() + latestHeight := s.blockchain.LastBlockHeight() if minHeight == 0 { minHeight = 1 @@ -393,7 +392,7 @@ func (s *Service) ListValidators() (*ResultListValidators, error) { return }) return &ResultListValidators{ - BlockHeight: s.blockchain.Tip.LastBlockHeight(), + BlockHeight: s.blockchain.LastBlockHeight(), BondedValidators: concreteValidators, UnbondingValidators: nil, }, nil diff --git a/rpc/subscriptions.go b/rpc/subscriptions.go index 691df6dde2ff3bf9049fc04a897591e904e38935..35808890bcf78067304934bd41c0d7015bd82fda 100644 --- a/rpc/subscriptions.go +++ b/rpc/subscriptions.go @@ -40,7 +40,7 @@ type SubscriptionsCache struct { mtx *sync.Mutex events []interface{} ts time.Time - subId string + subID string } func NewSubscriptions(service *Service) *Subscriptions { @@ -56,12 +56,12 @@ func NewSubscriptions(service *Service) *Subscriptions { return es } -func newSubscriptionsCache() *SubscriptionsCache { +func newSubscriptionsCache(subID string) *SubscriptionsCache { return &SubscriptionsCache{ - &sync.Mutex{}, - make([]interface{}, 0), - time.Now(), - "", + subID: subID, + mtx: &sync.Mutex{}, + events: make([]interface{}, 0), + ts: time.Now(), } } @@ -100,26 +100,26 @@ func reap(es *Subscriptions) { // happen it's for an insignificant amount of time (the time it takes to // carry out SubscriptionsCache.poll() ). func (subs *Subscriptions) Add(eventId string) (string, error) { - subId, err := event.GenerateSubscriptionID() + subID, err := event.GenerateSubscriptionID() if err != nil { return "", err } - cache := newSubscriptionsCache() - err = subs.service.Subscribe(context.Background(), subId, eventId, func(resultEvent *ResultEvent) bool { + subs.mtx.Lock() + defer subs.mtx.Unlock() + cache := newSubscriptionsCache(subID) + subs.subs[subID] = cache + + err = subs.service.Subscribe(context.Background(), subID, eventId, func(resultEvent *ResultEvent) (stop bool) { cache.mtx.Lock() defer cache.mtx.Unlock() cache.events = append(cache.events, resultEvent) - return true + return }) if err != nil { return "", err } - cache.subId = subId - subs.mtx.Lock() - defer subs.mtx.Unlock() - subs.subs[subId] = cache - return subId, nil + return subID, nil } func (subs *Subscriptions) Poll(subId string) ([]interface{}, error) { diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index e0091353ae9756a2bbc37eda4554135106ae5664..b04a6e27744bbb502cefbd19ad146772625e480b 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -2,7 +2,6 @@ package test import ( "context" - "fmt" "testing" "github.com/hyperledger/burrow/consensus/tendermint" @@ -11,7 +10,6 @@ import ( "github.com/hyperledger/burrow/execution/pbtransactor" "github.com/hyperledger/burrow/rpc" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/types" "google.golang.org/grpc" ) @@ -28,16 +26,20 @@ func NewExecutionEventsClient(t testing.TB) pbevents.ExecutionEventsClient { return pbevents.NewExecutionEventsClient(conn) } -func CommittedTxCount(t *testing.T, em event.Emitter, committedTxCountIndex *int) chan int { +func NewEventsClient(t testing.TB) pbevents.EventsClient { + conn, err := grpc.Dial(rpc.DefaultGRPCConfig().ListenAddress, grpc.WithInsecure()) + require.NoError(t, err) + return pbevents.NewEventsClient(conn) +} + +func CommittedTxCount(t *testing.T, em event.Emitter) chan int { var numTxs int64 emptyBlocks := 0 maxEmptyBlocks := 2 outCh := make(chan int) - ch := make(chan *types.EventDataNewBlock) ctx := context.Background() - subscriber := fmt.Sprintf("committedTxCount_%v", *committedTxCountIndex) - *committedTxCountIndex++ - require.NoError(t, tendermint.SubscribeNewBlock(ctx, em, subscriber, ch)) + ch, err := tendermint.SubscribeNewBlock(ctx, em) + require.NoError(t, err) go func() { for ed := range ch { @@ -52,7 +54,6 @@ func CommittedTxCount(t *testing.T, em event.Emitter, committedTxCountIndex *int numTxs += ed.Block.NumTxs t.Logf("Total TXs committed at block %v: %v (+%v)\n", ed.Block.Height, numTxs, ed.Block.NumTxs) } - require.NoError(t, em.UnsubscribeAll(ctx, subscriber)) outCh <- int(numTxs) }() return outCh diff --git a/rpc/tm/methods.go b/rpc/tm/methods.go index 25be7c08cfecd5006a83566f359d311ea6b02d02..6e892df8e645175fda3f3e5dd93f4fd57e963a6f 100644 --- a/rpc/tm/methods.go +++ b/rpc/tm/methods.go @@ -106,7 +106,7 @@ func GetRoutes(service *rpc.Service, logger *logging.Logger) map[string]*server. ctx, cancel := context.WithTimeout(context.Background(), SubscriptionTimeout) defer cancel() - err = service.Subscribe(ctx, subscriptionID, eventID, func(resultEvent *rpc.ResultEvent) bool { + err = service.Subscribe(ctx, subscriptionID, eventID, func(resultEvent *rpc.ResultEvent) (stop bool) { keepAlive := wsCtx.TryWriteRPCResponse(types.NewRPCSuccessResponse( EventResponseID(wsCtx.Request.ID, eventID), resultEvent)) if !keepAlive { @@ -114,7 +114,7 @@ func GetRoutes(service *rpc.Service, logger *logging.Logger) map[string]*server. "subscription_id", subscriptionID, "event_id", eventID) } - return keepAlive + return !keepAlive }) if err != nil { return nil, err diff --git a/rpc/v0/integration/v0_test.go b/rpc/v0/integration/v0_test.go index b75594cc88fb0d7c2975d5355c6b4047419ed0dd..484e9dd9788c56347bcbb2db1f49ed39769609aa 100644 --- a/rpc/v0/integration/v0_test.go +++ b/rpc/v0/integration/v0_test.go @@ -37,7 +37,7 @@ func TestTransactCallNoCode(t *testing.T) { toAddress := privateAccounts[2].Address() numCreates := 1000 - countCh := test.CommittedTxCount(t, kern.Emitter, &committedTxCountIndex) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numCreates; i++ { receipt, err := cli.Transact(v0.TransactParam{ InputAccount: inputAccount(i), @@ -62,7 +62,7 @@ func TestTransactCreate(t *testing.T) { // Flip flops between sending private key and input address to test private key and address based signing bc, err := hex.DecodeString(test.StrangeLoopByteCode) require.NoError(t, err) - countCh := test.CommittedTxCount(t, kern.Emitter, &committedTxCountIndex) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numGoroutines; i++ { go func() { for j := 0; j < numCreates; j++ { @@ -110,7 +110,7 @@ func TestTransactAndHold(t *testing.T) { numGoroutines := 5 numRuns := 2 - countCh := test.CommittedTxCount(t, kern.Emitter, &committedTxCountIndex) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numGoroutines; i++ { for j := 0; j < numRuns; j++ { create, err := cli.TransactAndHold(v0.TransactParam{ @@ -142,7 +142,7 @@ func TestTransactAndHold(t *testing.T) { func TestSend(t *testing.T) { cli := v0.NewV0Client("http://localhost:1337/rpc") numSends := 1000 - countCh := test.CommittedTxCount(t, kern.Emitter, &committedTxCountIndex) + countCh := test.CommittedTxCount(t, kern.Emitter) for i := 0; i < numSends; i++ { send, err := cli.Send(v0.SendParam{ InputAccount: inputAccount(i), @@ -171,8 +171,6 @@ func TestSendAndHold(t *testing.T) { // Helpers -var committedTxCountIndex = 0 - var inputPrivateKey = privateAccounts[0].PrivateKey().RawBytes() var inputAddress = privateAccounts[0].Address().Bytes() diff --git a/rpc/v0/websocket_service.go b/rpc/v0/websocket_service.go index ed75f1ce0cd0ce3bb22373468a6dcb59fbee2519..259a3f13d6e8a01900eb098cd24489503c30d616 100644 --- a/rpc/v0/websocket_service.go +++ b/rpc/v0/websocket_service.go @@ -137,9 +137,9 @@ func (ws *WebsocketService) EventSubscribe(request *rpc.RPCRequest, return nil, rpc.INTERNAL_ERROR, err } - err = ws.service.Subscribe(context.Background(), subId, eventId, func(resultEvent *rpc.ResultEvent) bool { + err = ws.service.Subscribe(context.Background(), subId, eventId, func(resultEvent *rpc.ResultEvent) (stop bool) { ws.writeResponse(subId, resultEvent, session) - return true + return }) if err != nil { return nil, rpc.INTERNAL_ERROR, err diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..e855b1f5c4abc0122d223e2c2705ea9a6d2d4899 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go @@ -0,0 +1,2812 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/descriptor.proto + +package descriptor // import "github.com/golang/protobuf/protoc-gen-go/descriptor" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type FieldDescriptorProto_Type int32 + +const ( + // 0 is reserved for errors. + // Order is weird for historical reasons. + FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 + FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 + FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 + FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 + FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 + FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 + FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 + FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 + // New in version 2. + FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 + FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 + FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 + FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 + FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 + FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 + FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 +) + +var FieldDescriptorProto_Type_name = map[int32]string{ + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", +} +var FieldDescriptorProto_Type_value = map[string]int32{ + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, +} + +func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { + p := new(FieldDescriptorProto_Type) + *p = x + return p +} +func (x FieldDescriptorProto_Type) String() string { + return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) +} +func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") + if err != nil { + return err + } + *x = FieldDescriptorProto_Type(value) + return nil +} +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{4, 0} +} + +type FieldDescriptorProto_Label int32 + +const ( + // 0 is reserved for errors + FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 + FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 +) + +var FieldDescriptorProto_Label_name = map[int32]string{ + 1: "LABEL_OPTIONAL", + 2: "LABEL_REQUIRED", + 3: "LABEL_REPEATED", +} +var FieldDescriptorProto_Label_value = map[string]int32{ + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3, +} + +func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { + p := new(FieldDescriptorProto_Label) + *p = x + return p +} +func (x FieldDescriptorProto_Label) String() string { + return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) +} +func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") + if err != nil { + return err + } + *x = FieldDescriptorProto_Label(value) + return nil +} +func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{4, 1} +} + +// Generated classes can be optimized for speed or code size. +type FileOptions_OptimizeMode int32 + +const ( + FileOptions_SPEED FileOptions_OptimizeMode = 1 + // etc. + FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 + FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 +) + +var FileOptions_OptimizeMode_name = map[int32]string{ + 1: "SPEED", + 2: "CODE_SIZE", + 3: "LITE_RUNTIME", +} +var FileOptions_OptimizeMode_value = map[string]int32{ + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3, +} + +func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { + p := new(FileOptions_OptimizeMode) + *p = x + return p +} +func (x FileOptions_OptimizeMode) String() string { + return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) +} +func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") + if err != nil { + return err + } + *x = FileOptions_OptimizeMode(value) + return nil +} +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{10, 0} +} + +type FieldOptions_CType int32 + +const ( + // Default mode. + FieldOptions_STRING FieldOptions_CType = 0 + FieldOptions_CORD FieldOptions_CType = 1 + FieldOptions_STRING_PIECE FieldOptions_CType = 2 +) + +var FieldOptions_CType_name = map[int32]string{ + 0: "STRING", + 1: "CORD", + 2: "STRING_PIECE", +} +var FieldOptions_CType_value = map[string]int32{ + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2, +} + +func (x FieldOptions_CType) Enum() *FieldOptions_CType { + p := new(FieldOptions_CType) + *p = x + return p +} +func (x FieldOptions_CType) String() string { + return proto.EnumName(FieldOptions_CType_name, int32(x)) +} +func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") + if err != nil { + return err + } + *x = FieldOptions_CType(value) + return nil +} +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{12, 0} +} + +type FieldOptions_JSType int32 + +const ( + // Use the default type. + FieldOptions_JS_NORMAL FieldOptions_JSType = 0 + // Use JavaScript strings. + FieldOptions_JS_STRING FieldOptions_JSType = 1 + // Use JavaScript numbers. + FieldOptions_JS_NUMBER FieldOptions_JSType = 2 +) + +var FieldOptions_JSType_name = map[int32]string{ + 0: "JS_NORMAL", + 1: "JS_STRING", + 2: "JS_NUMBER", +} +var FieldOptions_JSType_value = map[string]int32{ + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2, +} + +func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { + p := new(FieldOptions_JSType) + *p = x + return p +} +func (x FieldOptions_JSType) String() string { + return proto.EnumName(FieldOptions_JSType_name, int32(x)) +} +func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") + if err != nil { + return err + } + *x = FieldOptions_JSType(value) + return nil +} +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{12, 1} +} + +// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, +// or neither? HTTP based RPC implementation may choose GET verb for safe +// methods, and PUT verb for idempotent methods instead of the default POST. +type MethodOptions_IdempotencyLevel int32 + +const ( + MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 + MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 + MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 +) + +var MethodOptions_IdempotencyLevel_name = map[int32]string{ + 0: "IDEMPOTENCY_UNKNOWN", + 1: "NO_SIDE_EFFECTS", + 2: "IDEMPOTENT", +} +var MethodOptions_IdempotencyLevel_value = map[string]int32{ + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2, +} + +func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { + p := new(MethodOptions_IdempotencyLevel) + *p = x + return p +} +func (x MethodOptions_IdempotencyLevel) String() string { + return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) +} +func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") + if err != nil { + return err + } + *x = MethodOptions_IdempotencyLevel(value) + return nil +} +func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{17, 0} +} + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +type FileDescriptorSet struct { + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } +func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorSet) ProtoMessage() {} +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{0} +} +func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) +} +func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorSet.Merge(dst, src) +} +func (m *FileDescriptorSet) XXX_Size() int { + return xxx_messageInfo_FileDescriptorSet.Size(m) +} +func (m *FileDescriptorSet) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo + +func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { + if m != nil { + return m.File + } + return nil +} + +// Describes a complete .proto file. +type FileDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + // Names of files imported by this file. + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + // Indexes of the public imported files in the dependency list above. + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // All top-level definitions in this file. + MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } +func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorProto) ProtoMessage() {} +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{1} +} +func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) +} +func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorProto.Merge(dst, src) +} +func (m *FileDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FileDescriptorProto.Size(m) +} +func (m *FileDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo + +func (m *FileDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FileDescriptorProto) GetPackage() string { + if m != nil && m.Package != nil { + return *m.Package + } + return "" +} + +func (m *FileDescriptorProto) GetDependency() []string { + if m != nil { + return m.Dependency + } + return nil +} + +func (m *FileDescriptorProto) GetPublicDependency() []int32 { + if m != nil { + return m.PublicDependency + } + return nil +} + +func (m *FileDescriptorProto) GetWeakDependency() []int32 { + if m != nil { + return m.WeakDependency + } + return nil +} + +func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { + if m != nil { + return m.MessageType + } + return nil +} + +func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { + if m != nil { + return m.Service + } + return nil +} + +func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *FileDescriptorProto) GetOptions() *FileOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { + if m != nil { + return m.SourceCodeInfo + } + return nil +} + +func (m *FileDescriptorProto) GetSyntax() string { + if m != nil && m.Syntax != nil { + return *m.Syntax + } + return "" +} + +// Describes a message type. +type DescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` + NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` + OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` + Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` + ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } +func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto) ProtoMessage() {} +func (*DescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{2} +} +func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) +} +func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto.Merge(dst, src) +} +func (m *DescriptorProto) XXX_Size() int { + return xxx_messageInfo_DescriptorProto.Size(m) +} +func (m *DescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo + +func (m *DescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DescriptorProto) GetField() []*FieldDescriptorProto { + if m != nil { + return m.Field + } + return nil +} + +func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *DescriptorProto) GetNestedType() []*DescriptorProto { + if m != nil { + return m.NestedType + } + return nil +} + +func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { + if m != nil { + return m.ExtensionRange + } + return nil +} + +func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { + if m != nil { + return m.OneofDecl + } + return nil +} + +func (m *DescriptorProto) GetOptions() *MessageOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *DescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +type DescriptorProto_ExtensionRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } +func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{2, 0} +} +func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(dst, src) +} +func (m *DescriptorProto_ExtensionRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) +} +func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo + +func (m *DescriptorProto_ExtensionRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { + if m != nil { + return m.Options + } + return nil +} + +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } +func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ReservedRange) ProtoMessage() {} +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{2, 1} +} +func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ReservedRange.Merge(dst, src) +} +func (m *DescriptorProto_ReservedRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) +} +func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo + +func (m *DescriptorProto_ReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +type ExtensionRangeOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } +func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } +func (*ExtensionRangeOptions) ProtoMessage() {} +func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{3} +} + +var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ExtensionRangeOptions +} +func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) +} +func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) +} +func (dst *ExtensionRangeOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRangeOptions.Merge(dst, src) +} +func (m *ExtensionRangeOptions) XXX_Size() int { + return xxx_messageInfo_ExtensionRangeOptions.Size(m) +} +func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo + +func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// Describes a field within a message. +type FieldDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` + Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } +func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FieldDescriptorProto) ProtoMessage() {} +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{4} +} +func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) +} +func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *FieldDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldDescriptorProto.Merge(dst, src) +} +func (m *FieldDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FieldDescriptorProto.Size(m) +} +func (m *FieldDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo + +func (m *FieldDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { + if m != nil && m.Label != nil { + return *m.Label + } + return FieldDescriptorProto_LABEL_OPTIONAL +} + +func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return FieldDescriptorProto_TYPE_DOUBLE +} + +func (m *FieldDescriptorProto) GetTypeName() string { + if m != nil && m.TypeName != nil { + return *m.TypeName + } + return "" +} + +func (m *FieldDescriptorProto) GetExtendee() string { + if m != nil && m.Extendee != nil { + return *m.Extendee + } + return "" +} + +func (m *FieldDescriptorProto) GetDefaultValue() string { + if m != nil && m.DefaultValue != nil { + return *m.DefaultValue + } + return "" +} + +func (m *FieldDescriptorProto) GetOneofIndex() int32 { + if m != nil && m.OneofIndex != nil { + return *m.OneofIndex + } + return 0 +} + +func (m *FieldDescriptorProto) GetJsonName() string { + if m != nil && m.JsonName != nil { + return *m.JsonName + } + return "" +} + +func (m *FieldDescriptorProto) GetOptions() *FieldOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a oneof. +type OneofDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } +func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*OneofDescriptorProto) ProtoMessage() {} +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{5} +} +func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) +} +func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *OneofDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofDescriptorProto.Merge(dst, src) +} +func (m *OneofDescriptorProto) XXX_Size() int { + return xxx_messageInfo_OneofDescriptorProto.Size(m) +} +func (m *OneofDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo + +func (m *OneofDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *OneofDescriptorProto) GetOptions() *OneofOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes an enum type. +type EnumDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } +func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto) ProtoMessage() {} +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{6} +} +func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) +} +func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *EnumDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto.Merge(dst, src) +} +func (m *EnumDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto.Size(m) +} +func (m *EnumDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo + +func (m *EnumDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { + if m != nil { + return m.Value + } + return nil +} + +func (m *EnumDescriptorProto) GetOptions() *EnumOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } +func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{6, 0} +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) +} +func (dst *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(dst, src) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo + +func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Describes a value within an enum. +type EnumValueDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } +func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumValueDescriptorProto) ProtoMessage() {} +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{7} +} +func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) +} +func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueDescriptorProto.Merge(dst, src) +} +func (m *EnumValueDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumValueDescriptorProto.Size(m) +} +func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo + +func (m *EnumValueDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumValueDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a service. +type ServiceDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } +func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*ServiceDescriptorProto) ProtoMessage() {} +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{8} +} +func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) +} +func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *ServiceDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDescriptorProto.Merge(dst, src) +} +func (m *ServiceDescriptorProto) XXX_Size() int { + return xxx_messageInfo_ServiceDescriptorProto.Size(m) +} +func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo + +func (m *ServiceDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { + if m != nil { + return m.Method + } + return nil +} + +func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a method of a service. +type MethodDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` + OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` + Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + // Identifies if client streams multiple client messages + ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` + // Identifies if server streams multiple server messages + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } +func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*MethodDescriptorProto) ProtoMessage() {} +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{9} +} +func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) +} +func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *MethodDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodDescriptorProto.Merge(dst, src) +} +func (m *MethodDescriptorProto) XXX_Size() int { + return xxx_messageInfo_MethodDescriptorProto.Size(m) +} +func (m *MethodDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo + +const Default_MethodDescriptorProto_ClientStreaming bool = false +const Default_MethodDescriptorProto_ServerStreaming bool = false + +func (m *MethodDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MethodDescriptorProto) GetInputType() string { + if m != nil && m.InputType != nil { + return *m.InputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOutputType() string { + if m != nil && m.OutputType != nil { + return *m.OutputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOptions() *MethodOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *MethodDescriptorProto) GetClientStreaming() bool { + if m != nil && m.ClientStreaming != nil { + return *m.ClientStreaming + } + return Default_MethodDescriptorProto_ClientStreaming +} + +func (m *MethodDescriptorProto) GetServerStreaming() bool { + if m != nil && m.ServerStreaming != nil { + return *m.ServerStreaming + } + return Default_MethodDescriptorProto_ServerStreaming +} + +type FileOptions struct { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` + // This option does nothing. + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` + OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` + JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` + PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` + PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` + // Namespace for generated classes; defaults to the package. + CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileOptions) Reset() { *m = FileOptions{} } +func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (*FileOptions) ProtoMessage() {} +func (*FileOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{10} +} + +var extRange_FileOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FileOptions +} +func (m *FileOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileOptions.Unmarshal(m, b) +} +func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) +} +func (dst *FileOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileOptions.Merge(dst, src) +} +func (m *FileOptions) XXX_Size() int { + return xxx_messageInfo_FileOptions.Size(m) +} +func (m *FileOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FileOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FileOptions proto.InternalMessageInfo + +const Default_FileOptions_JavaMultipleFiles bool = false +const Default_FileOptions_JavaStringCheckUtf8 bool = false +const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED +const Default_FileOptions_CcGenericServices bool = false +const Default_FileOptions_JavaGenericServices bool = false +const Default_FileOptions_PyGenericServices bool = false +const Default_FileOptions_PhpGenericServices bool = false +const Default_FileOptions_Deprecated bool = false +const Default_FileOptions_CcEnableArenas bool = false + +func (m *FileOptions) GetJavaPackage() string { + if m != nil && m.JavaPackage != nil { + return *m.JavaPackage + } + return "" +} + +func (m *FileOptions) GetJavaOuterClassname() string { + if m != nil && m.JavaOuterClassname != nil { + return *m.JavaOuterClassname + } + return "" +} + +func (m *FileOptions) GetJavaMultipleFiles() bool { + if m != nil && m.JavaMultipleFiles != nil { + return *m.JavaMultipleFiles + } + return Default_FileOptions_JavaMultipleFiles +} + +// Deprecated: Do not use. +func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { + if m != nil && m.JavaGenerateEqualsAndHash != nil { + return *m.JavaGenerateEqualsAndHash + } + return false +} + +func (m *FileOptions) GetJavaStringCheckUtf8() bool { + if m != nil && m.JavaStringCheckUtf8 != nil { + return *m.JavaStringCheckUtf8 + } + return Default_FileOptions_JavaStringCheckUtf8 +} + +func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { + if m != nil && m.OptimizeFor != nil { + return *m.OptimizeFor + } + return Default_FileOptions_OptimizeFor +} + +func (m *FileOptions) GetGoPackage() string { + if m != nil && m.GoPackage != nil { + return *m.GoPackage + } + return "" +} + +func (m *FileOptions) GetCcGenericServices() bool { + if m != nil && m.CcGenericServices != nil { + return *m.CcGenericServices + } + return Default_FileOptions_CcGenericServices +} + +func (m *FileOptions) GetJavaGenericServices() bool { + if m != nil && m.JavaGenericServices != nil { + return *m.JavaGenericServices + } + return Default_FileOptions_JavaGenericServices +} + +func (m *FileOptions) GetPyGenericServices() bool { + if m != nil && m.PyGenericServices != nil { + return *m.PyGenericServices + } + return Default_FileOptions_PyGenericServices +} + +func (m *FileOptions) GetPhpGenericServices() bool { + if m != nil && m.PhpGenericServices != nil { + return *m.PhpGenericServices + } + return Default_FileOptions_PhpGenericServices +} + +func (m *FileOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FileOptions_Deprecated +} + +func (m *FileOptions) GetCcEnableArenas() bool { + if m != nil && m.CcEnableArenas != nil { + return *m.CcEnableArenas + } + return Default_FileOptions_CcEnableArenas +} + +func (m *FileOptions) GetObjcClassPrefix() string { + if m != nil && m.ObjcClassPrefix != nil { + return *m.ObjcClassPrefix + } + return "" +} + +func (m *FileOptions) GetCsharpNamespace() string { + if m != nil && m.CsharpNamespace != nil { + return *m.CsharpNamespace + } + return "" +} + +func (m *FileOptions) GetSwiftPrefix() string { + if m != nil && m.SwiftPrefix != nil { + return *m.SwiftPrefix + } + return "" +} + +func (m *FileOptions) GetPhpClassPrefix() string { + if m != nil && m.PhpClassPrefix != nil { + return *m.PhpClassPrefix + } + return "" +} + +func (m *FileOptions) GetPhpNamespace() string { + if m != nil && m.PhpNamespace != nil { + return *m.PhpNamespace + } + return "" +} + +func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MessageOptions struct { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map<KeyType, ValueType> map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageOptions) Reset() { *m = MessageOptions{} } +func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (*MessageOptions) ProtoMessage() {} +func (*MessageOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{11} +} + +var extRange_MessageOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MessageOptions +} +func (m *MessageOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageOptions.Unmarshal(m, b) +} +func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) +} +func (dst *MessageOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageOptions.Merge(dst, src) +} +func (m *MessageOptions) XXX_Size() int { + return xxx_messageInfo_MessageOptions.Size(m) +} +func (m *MessageOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MessageOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageOptions proto.InternalMessageInfo + +const Default_MessageOptions_MessageSetWireFormat bool = false +const Default_MessageOptions_NoStandardDescriptorAccessor bool = false +const Default_MessageOptions_Deprecated bool = false + +func (m *MessageOptions) GetMessageSetWireFormat() bool { + if m != nil && m.MessageSetWireFormat != nil { + return *m.MessageSetWireFormat + } + return Default_MessageOptions_MessageSetWireFormat +} + +func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { + if m != nil && m.NoStandardDescriptorAccessor != nil { + return *m.NoStandardDescriptorAccessor + } + return Default_MessageOptions_NoStandardDescriptorAccessor +} + +func (m *MessageOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MessageOptions_Deprecated +} + +func (m *MessageOptions) GetMapEntry() bool { + if m != nil && m.MapEntry != nil { + return *m.MapEntry + } + return false +} + +func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type FieldOptions struct { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // For Google-internal migration only. Do not use. + Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldOptions) Reset() { *m = FieldOptions{} } +func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (*FieldOptions) ProtoMessage() {} +func (*FieldOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{12} +} + +var extRange_FieldOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FieldOptions +} +func (m *FieldOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldOptions.Unmarshal(m, b) +} +func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) +} +func (dst *FieldOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldOptions.Merge(dst, src) +} +func (m *FieldOptions) XXX_Size() int { + return xxx_messageInfo_FieldOptions.Size(m) +} +func (m *FieldOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FieldOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldOptions proto.InternalMessageInfo + +const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING +const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL +const Default_FieldOptions_Lazy bool = false +const Default_FieldOptions_Deprecated bool = false +const Default_FieldOptions_Weak bool = false + +func (m *FieldOptions) GetCtype() FieldOptions_CType { + if m != nil && m.Ctype != nil { + return *m.Ctype + } + return Default_FieldOptions_Ctype +} + +func (m *FieldOptions) GetPacked() bool { + if m != nil && m.Packed != nil { + return *m.Packed + } + return false +} + +func (m *FieldOptions) GetJstype() FieldOptions_JSType { + if m != nil && m.Jstype != nil { + return *m.Jstype + } + return Default_FieldOptions_Jstype +} + +func (m *FieldOptions) GetLazy() bool { + if m != nil && m.Lazy != nil { + return *m.Lazy + } + return Default_FieldOptions_Lazy +} + +func (m *FieldOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FieldOptions_Deprecated +} + +func (m *FieldOptions) GetWeak() bool { + if m != nil && m.Weak != nil { + return *m.Weak + } + return Default_FieldOptions_Weak +} + +func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type OneofOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofOptions) Reset() { *m = OneofOptions{} } +func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (*OneofOptions) ProtoMessage() {} +func (*OneofOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{13} +} + +var extRange_OneofOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OneofOptions +} +func (m *OneofOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofOptions.Unmarshal(m, b) +} +func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) +} +func (dst *OneofOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofOptions.Merge(dst, src) +} +func (m *OneofOptions) XXX_Size() int { + return xxx_messageInfo_OneofOptions.Size(m) +} +func (m *OneofOptions) XXX_DiscardUnknown() { + xxx_messageInfo_OneofOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofOptions proto.InternalMessageInfo + +func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumOptions struct { + // Set this option to true to allow mapping different tag names to the same + // value. + AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumOptions) Reset() { *m = EnumOptions{} } +func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (*EnumOptions) ProtoMessage() {} +func (*EnumOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{14} +} + +var extRange_EnumOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumOptions +} +func (m *EnumOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumOptions.Unmarshal(m, b) +} +func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) +} +func (dst *EnumOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumOptions.Merge(dst, src) +} +func (m *EnumOptions) XXX_Size() int { + return xxx_messageInfo_EnumOptions.Size(m) +} +func (m *EnumOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumOptions proto.InternalMessageInfo + +const Default_EnumOptions_Deprecated bool = false + +func (m *EnumOptions) GetAllowAlias() bool { + if m != nil && m.AllowAlias != nil { + return *m.AllowAlias + } + return false +} + +func (m *EnumOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumOptions_Deprecated +} + +func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumValueOptions struct { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } +func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (*EnumValueOptions) ProtoMessage() {} +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{15} +} + +var extRange_EnumValueOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumValueOptions +} +func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) +} +func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) +} +func (dst *EnumValueOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueOptions.Merge(dst, src) +} +func (m *EnumValueOptions) XXX_Size() int { + return xxx_messageInfo_EnumValueOptions.Size(m) +} +func (m *EnumValueOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo + +const Default_EnumValueOptions_Deprecated bool = false + +func (m *EnumValueOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumValueOptions_Deprecated +} + +func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type ServiceOptions struct { + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } +func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (*ServiceOptions) ProtoMessage() {} +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{16} +} + +var extRange_ServiceOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ServiceOptions +} +func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) +} +func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) +} +func (dst *ServiceOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceOptions.Merge(dst, src) +} +func (m *ServiceOptions) XXX_Size() int { + return xxx_messageInfo_ServiceOptions.Size(m) +} +func (m *ServiceOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo + +const Default_ServiceOptions_Deprecated bool = false + +func (m *ServiceOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_ServiceOptions_Deprecated +} + +func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MethodOptions struct { + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodOptions) Reset() { *m = MethodOptions{} } +func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (*MethodOptions) ProtoMessage() {} +func (*MethodOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{17} +} + +var extRange_MethodOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MethodOptions +} +func (m *MethodOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodOptions.Unmarshal(m, b) +} +func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) +} +func (dst *MethodOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodOptions.Merge(dst, src) +} +func (m *MethodOptions) XXX_Size() int { + return xxx_messageInfo_MethodOptions.Size(m) +} +func (m *MethodOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MethodOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodOptions proto.InternalMessageInfo + +const Default_MethodOptions_Deprecated bool = false +const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN + +func (m *MethodOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MethodOptions_Deprecated +} + +func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { + if m != nil && m.IdempotencyLevel != nil { + return *m.IdempotencyLevel + } + return Default_MethodOptions_IdempotencyLevel +} + +func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +type UninterpretedOption struct { + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } +func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption) ProtoMessage() {} +func (*UninterpretedOption) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{18} +} +func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) +} +func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) +} +func (dst *UninterpretedOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption.Merge(dst, src) +} +func (m *UninterpretedOption) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption.Size(m) +} +func (m *UninterpretedOption) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo + +func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { + if m != nil { + return m.Name + } + return nil +} + +func (m *UninterpretedOption) GetIdentifierValue() string { + if m != nil && m.IdentifierValue != nil { + return *m.IdentifierValue + } + return "" +} + +func (m *UninterpretedOption) GetPositiveIntValue() uint64 { + if m != nil && m.PositiveIntValue != nil { + return *m.PositiveIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetNegativeIntValue() int64 { + if m != nil && m.NegativeIntValue != nil { + return *m.NegativeIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *UninterpretedOption) GetStringValue() []byte { + if m != nil { + return m.StringValue + } + return nil +} + +func (m *UninterpretedOption) GetAggregateValue() string { + if m != nil && m.AggregateValue != nil { + return *m.AggregateValue + } + return "" +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } +func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption_NamePart) ProtoMessage() {} +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{18, 0} +} +func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) +} +func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) +} +func (dst *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption_NamePart.Merge(dst, src) +} +func (m *UninterpretedOption_NamePart) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) +} +func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo + +func (m *UninterpretedOption_NamePart) GetNamePart() string { + if m != nil && m.NamePart != nil { + return *m.NamePart + } + return "" +} + +func (m *UninterpretedOption_NamePart) GetIsExtension() bool { + if m != nil && m.IsExtension != nil { + return *m.IsExtension + } + return false +} + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +type SourceCodeInfo struct { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } +func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo) ProtoMessage() {} +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{19} +} +func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) +} +func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) +} +func (dst *SourceCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo.Merge(dst, src) +} +func (m *SourceCodeInfo) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo.Size(m) +} +func (m *SourceCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo + +func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if m != nil { + return m.Location + } + return nil +} + +type SourceCodeInfo_Location struct { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` + TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` + LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } +func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo_Location) ProtoMessage() {} +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{19, 0} +} +func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) +} +func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) +} +func (dst *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo_Location.Merge(dst, src) +} +func (m *SourceCodeInfo_Location) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo_Location.Size(m) +} +func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo + +func (m *SourceCodeInfo_Location) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *SourceCodeInfo_Location) GetSpan() []int32 { + if m != nil { + return m.Span + } + return nil +} + +func (m *SourceCodeInfo_Location) GetLeadingComments() string { + if m != nil && m.LeadingComments != nil { + return *m.LeadingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetTrailingComments() string { + if m != nil && m.TrailingComments != nil { + return *m.TrailingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { + if m != nil { + return m.LeadingDetachedComments + } + return nil +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{20} +} +func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) +} +func (dst *GeneratedCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo.Merge(dst, src) +} +func (m *GeneratedCodeInfo) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo.Size(m) +} +func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo + +func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if m != nil { + return m.Annotation + } + return nil +} + +type GeneratedCodeInfo_Annotation struct { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Identifies the filesystem path to the original source .proto. + SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } +func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} +func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_4df4cb5f42392df6, []int{20, 0} +} +func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) +} +func (dst *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(dst, src) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) +} +func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo + +func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { + if m != nil && m.SourceFile != nil { + return *m.SourceFile + } + return "" +} + +func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { + if m != nil && m.Begin != nil { + return *m.Begin + } + return 0 +} + +func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func init() { + proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") + proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") + proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") + proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") + proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") + proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") + proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") + proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") + proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") + proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") + proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) + proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) + proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) + proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) + proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) +} + +func init() { + proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor_descriptor_4df4cb5f42392df6) +} + +var fileDescriptor_descriptor_4df4cb5f42392df6 = []byte{ + // 2555 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x6e, 0x1b, 0xc7, + 0xf5, 0xcf, 0xf2, 0x4b, 0xe4, 0x21, 0x45, 0x8d, 0x46, 0x8a, 0xbd, 0x56, 0x3e, 0x2c, 0x33, 0x1f, + 0x96, 0x9d, 0x7f, 0xa8, 0xc0, 0xb1, 0x1d, 0x47, 0xfe, 0x23, 0x2d, 0x45, 0xae, 0x15, 0xaa, 0x12, + 0xc9, 0x2e, 0xa9, 0xe6, 0x03, 0x28, 0x16, 0xa3, 0xdd, 0x21, 0xb9, 0xf6, 0x72, 0x77, 0xb3, 0xbb, + 0xb4, 0xad, 0xa0, 0x17, 0x06, 0x7a, 0xd5, 0xab, 0xde, 0x16, 0x45, 0xd1, 0x8b, 0xde, 0x04, 0xe8, + 0x03, 0x14, 0xc8, 0x5d, 0x9f, 0xa0, 0x40, 0xde, 0xa0, 0x68, 0x0b, 0xb4, 0x8f, 0xd0, 0xcb, 0x62, + 0x66, 0x76, 0x97, 0xbb, 0x24, 0x15, 0x2b, 0x01, 0xe2, 0x5c, 0x91, 0xf3, 0x9b, 0xdf, 0x39, 0x73, + 0xe6, 0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 0x09, 0x57, 0x01, 0x38, 0xf0, 0xe0, 0xa8, 0xdb, + 0x18, 0xa0, 0x4c, 0xdc, 0x6e, 0x77, 0x06, 0x77, 0x6f, 0xa3, 0x6c, 0x2c, 0x70, 0x22, 0x80, 0x5c, + 0x92, 0xf0, 0xfe, 0x2d, 0x94, 0xc7, 0x08, 0x2a, 0x42, 0x41, 0xfb, 0x53, 0xa5, 0x75, 0xf7, 0x36, + 0x2a, 0xa4, 0x91, 0xf7, 0x6f, 0xa1, 0x15, 0xbc, 0x0a, 0x25, 0x8e, 0xec, 0x77, 0xbb, 0x47, 0xa8, + 0x18, 0xeb, 0xec, 0x0f, 0xd4, 0x76, 0xe7, 0x00, 0x95, 0x62, 0x9d, 0x07, 0x6a, 0xf7, 0xa4, 0x87, + 0x20, 0xd6, 0x70, 0xac, 0xf4, 0xfb, 0x8d, 0x03, 0x05, 0x95, 0x63, 0xc6, 0xfe, 0x67, 0x03, 0xa5, + 0x8f, 0x2a, 0x29, 0xb3, 0xde, 0xbf, 0x85, 0x56, 0xe3, 0x21, 0x94, 0xce, 0xc9, 0x31, 0xaa, 0xe2, + 0x75, 0x58, 0x15, 0x43, 0x44, 0x46, 0xac, 0xcd, 0x41, 0x77, 0x6f, 0x23, 0x34, 0x33, 0x44, 0x68, + 0x59, 0x4f, 0x01, 0x77, 0x6f, 0x23, 0x5c, 0x6b, 0x42, 0x9e, 0x47, 0x17, 0xc6, 0x50, 0x3d, 0x6a, + 0xec, 0x2b, 0x47, 0x5a, 0xb7, 0x37, 0x68, 0x77, 0x3b, 0x8d, 0x23, 0x24, 0xcd, 0x30, 0x55, 0xf9, + 0xf9, 0x49, 0x5b, 0x55, 0x5a, 0x28, 0x93, 0xc4, 0x7a, 0x4a, 0x63, 0xa0, 0xb4, 0x50, 0xb6, 0xa6, + 0xc3, 0xe6, 0xb2, 0x3c, 0xb9, 0x74, 0x67, 0x24, 0x96, 0x38, 0x73, 0xce, 0x12, 0x73, 0x5d, 0x0b, + 0x4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, 0x7b, 0x05, 0xf0, + 0x3f, 0x96, 0x3e, 0xff, 0x68, 0x64, 0x06, 0xe3, 0xe9, 0x69, 0x5d, 0x77, 0x26, 0xbb, 0x23, 0xc7, + 0x22, 0xf6, 0x68, 0xf6, 0x99, 0x93, 0xff, 0xd1, 0xdf, 0x1d, 0x51, 0xfb, 0xdd, 0x91, 0x93, 0xf8, + 0xe8, 0x79, 0x7f, 0xf6, 0xf7, 0xbf, 0x92, 0xf4, 0xa7, 0x4c, 0xf6, 0xa0, 0xb7, 0xff, 0xe7, 0xcc, + 0xd6, 0x81, 0x18, 0xae, 0x17, 0xb9, 0x47, 0xa5, 0x43, 0x8b, 0xea, 0x6c, 0xca, 0xff, 0x0b, 0x00, + 0x00, 0xff, 0xff, 0x1a, 0x28, 0x25, 0x79, 0x42, 0x1d, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..ab5b18893799483c543f1fddb40319d2f8b302e5 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -0,0 +1,925 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: grpc_reflection_v1alpha/reflection.proto + +package grpc_reflection_v1alpha + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// The message sent by the client when calling ServerReflectionInfo method. +type ServerReflectionRequest struct { + Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"` + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + // + // Types that are valid to be assigned to MessageRequest: + // *ServerReflectionRequest_FileByFilename + // *ServerReflectionRequest_FileContainingSymbol + // *ServerReflectionRequest_FileContainingExtension + // *ServerReflectionRequest_AllExtensionNumbersOfType + // *ServerReflectionRequest_ListServices + MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerReflectionRequest) Reset() { *m = ServerReflectionRequest{} } +func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) } +func (*ServerReflectionRequest) ProtoMessage() {} +func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{0} +} +func (m *ServerReflectionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerReflectionRequest.Unmarshal(m, b) +} +func (m *ServerReflectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerReflectionRequest.Marshal(b, m, deterministic) +} +func (dst *ServerReflectionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerReflectionRequest.Merge(dst, src) +} +func (m *ServerReflectionRequest) XXX_Size() int { + return xxx_messageInfo_ServerReflectionRequest.Size(m) +} +func (m *ServerReflectionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ServerReflectionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerReflectionRequest proto.InternalMessageInfo + +type isServerReflectionRequest_MessageRequest interface { + isServerReflectionRequest_MessageRequest() +} + +type ServerReflectionRequest_FileByFilename struct { + FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,oneof"` +} +type ServerReflectionRequest_FileContainingSymbol struct { + FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,oneof"` +} +type ServerReflectionRequest_FileContainingExtension struct { + FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,oneof"` +} +type ServerReflectionRequest_AllExtensionNumbersOfType struct { + AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,oneof"` +} +type ServerReflectionRequest_ListServices struct { + ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,oneof"` +} + +func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {} +func (*ServerReflectionRequest_FileContainingSymbol) isServerReflectionRequest_MessageRequest() {} +func (*ServerReflectionRequest_FileContainingExtension) isServerReflectionRequest_MessageRequest() {} +func (*ServerReflectionRequest_AllExtensionNumbersOfType) isServerReflectionRequest_MessageRequest() {} +func (*ServerReflectionRequest_ListServices) isServerReflectionRequest_MessageRequest() {} + +func (m *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest { + if m != nil { + return m.MessageRequest + } + return nil +} + +func (m *ServerReflectionRequest) GetHost() string { + if m != nil { + return m.Host + } + return "" +} + +func (m *ServerReflectionRequest) GetFileByFilename() string { + if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_FileByFilename); ok { + return x.FileByFilename + } + return "" +} + +func (m *ServerReflectionRequest) GetFileContainingSymbol() string { + if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_FileContainingSymbol); ok { + return x.FileContainingSymbol + } + return "" +} + +func (m *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest { + if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_FileContainingExtension); ok { + return x.FileContainingExtension + } + return nil +} + +func (m *ServerReflectionRequest) GetAllExtensionNumbersOfType() string { + if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_AllExtensionNumbersOfType); ok { + return x.AllExtensionNumbersOfType + } + return "" +} + +func (m *ServerReflectionRequest) GetListServices() string { + if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_ListServices); ok { + return x.ListServices + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ServerReflectionRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ServerReflectionRequest_OneofMarshaler, _ServerReflectionRequest_OneofUnmarshaler, _ServerReflectionRequest_OneofSizer, []interface{}{ + (*ServerReflectionRequest_FileByFilename)(nil), + (*ServerReflectionRequest_FileContainingSymbol)(nil), + (*ServerReflectionRequest_FileContainingExtension)(nil), + (*ServerReflectionRequest_AllExtensionNumbersOfType)(nil), + (*ServerReflectionRequest_ListServices)(nil), + } +} + +func _ServerReflectionRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ServerReflectionRequest) + // message_request + switch x := m.MessageRequest.(type) { + case *ServerReflectionRequest_FileByFilename: + b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeStringBytes(x.FileByFilename) + case *ServerReflectionRequest_FileContainingSymbol: + b.EncodeVarint(4<<3 | proto.WireBytes) + b.EncodeStringBytes(x.FileContainingSymbol) + case *ServerReflectionRequest_FileContainingExtension: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.FileContainingExtension); err != nil { + return err + } + case *ServerReflectionRequest_AllExtensionNumbersOfType: + b.EncodeVarint(6<<3 | proto.WireBytes) + b.EncodeStringBytes(x.AllExtensionNumbersOfType) + case *ServerReflectionRequest_ListServices: + b.EncodeVarint(7<<3 | proto.WireBytes) + b.EncodeStringBytes(x.ListServices) + case nil: + default: + return fmt.Errorf("ServerReflectionRequest.MessageRequest has unexpected type %T", x) + } + return nil +} + +func _ServerReflectionRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ServerReflectionRequest) + switch tag { + case 3: // message_request.file_by_filename + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.MessageRequest = &ServerReflectionRequest_FileByFilename{x} + return true, err + case 4: // message_request.file_containing_symbol + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.MessageRequest = &ServerReflectionRequest_FileContainingSymbol{x} + return true, err + case 5: // message_request.file_containing_extension + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ExtensionRequest) + err := b.DecodeMessage(msg) + m.MessageRequest = &ServerReflectionRequest_FileContainingExtension{msg} + return true, err + case 6: // message_request.all_extension_numbers_of_type + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.MessageRequest = &ServerReflectionRequest_AllExtensionNumbersOfType{x} + return true, err + case 7: // message_request.list_services + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.MessageRequest = &ServerReflectionRequest_ListServices{x} + return true, err + default: + return false, nil + } +} + +func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ServerReflectionRequest) + // message_request + switch x := m.MessageRequest.(type) { + case *ServerReflectionRequest_FileByFilename: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.FileByFilename))) + n += len(x.FileByFilename) + case *ServerReflectionRequest_FileContainingSymbol: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.FileContainingSymbol))) + n += len(x.FileContainingSymbol) + case *ServerReflectionRequest_FileContainingExtension: + s := proto.Size(x.FileContainingExtension) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerReflectionRequest_AllExtensionNumbersOfType: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.AllExtensionNumbersOfType))) + n += len(x.AllExtensionNumbersOfType) + case *ServerReflectionRequest_ListServices: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.ListServices))) + n += len(x.ListServices) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// The type name and extension number sent by the client when requesting +// file_containing_extension. +type ExtensionRequest struct { + // Fully-qualified type name. The format should be <package>.<type> + ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType" json:"containing_type,omitempty"` + ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber" json:"extension_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionRequest) Reset() { *m = ExtensionRequest{} } +func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) } +func (*ExtensionRequest) ProtoMessage() {} +func (*ExtensionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{1} +} +func (m *ExtensionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRequest.Unmarshal(m, b) +} +func (m *ExtensionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRequest.Marshal(b, m, deterministic) +} +func (dst *ExtensionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRequest.Merge(dst, src) +} +func (m *ExtensionRequest) XXX_Size() int { + return xxx_messageInfo_ExtensionRequest.Size(m) +} +func (m *ExtensionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRequest proto.InternalMessageInfo + +func (m *ExtensionRequest) GetContainingType() string { + if m != nil { + return m.ContainingType + } + return "" +} + +func (m *ExtensionRequest) GetExtensionNumber() int32 { + if m != nil { + return m.ExtensionNumber + } + return 0 +} + +// The message sent by the server to answer ServerReflectionInfo method. +type ServerReflectionResponse struct { + ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost" json:"valid_host,omitempty"` + OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest" json:"original_request,omitempty"` + // The server sets one of the following fields according to the + // message_request in the request. + // + // Types that are valid to be assigned to MessageResponse: + // *ServerReflectionResponse_FileDescriptorResponse + // *ServerReflectionResponse_AllExtensionNumbersResponse + // *ServerReflectionResponse_ListServicesResponse + // *ServerReflectionResponse_ErrorResponse + MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServerReflectionResponse) Reset() { *m = ServerReflectionResponse{} } +func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) } +func (*ServerReflectionResponse) ProtoMessage() {} +func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{2} +} +func (m *ServerReflectionResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServerReflectionResponse.Unmarshal(m, b) +} +func (m *ServerReflectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServerReflectionResponse.Marshal(b, m, deterministic) +} +func (dst *ServerReflectionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerReflectionResponse.Merge(dst, src) +} +func (m *ServerReflectionResponse) XXX_Size() int { + return xxx_messageInfo_ServerReflectionResponse.Size(m) +} +func (m *ServerReflectionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ServerReflectionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ServerReflectionResponse proto.InternalMessageInfo + +type isServerReflectionResponse_MessageResponse interface { + isServerReflectionResponse_MessageResponse() +} + +type ServerReflectionResponse_FileDescriptorResponse struct { + FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,oneof"` +} +type ServerReflectionResponse_AllExtensionNumbersResponse struct { + AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,oneof"` +} +type ServerReflectionResponse_ListServicesResponse struct { + ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,oneof"` +} +type ServerReflectionResponse_ErrorResponse struct { + ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,oneof"` +} + +func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() {} +func (*ServerReflectionResponse_AllExtensionNumbersResponse) isServerReflectionResponse_MessageResponse() { +} +func (*ServerReflectionResponse_ListServicesResponse) isServerReflectionResponse_MessageResponse() {} +func (*ServerReflectionResponse_ErrorResponse) isServerReflectionResponse_MessageResponse() {} + +func (m *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse { + if m != nil { + return m.MessageResponse + } + return nil +} + +func (m *ServerReflectionResponse) GetValidHost() string { + if m != nil { + return m.ValidHost + } + return "" +} + +func (m *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest { + if m != nil { + return m.OriginalRequest + } + return nil +} + +func (m *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse { + if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_FileDescriptorResponse); ok { + return x.FileDescriptorResponse + } + return nil +} + +func (m *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse { + if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_AllExtensionNumbersResponse); ok { + return x.AllExtensionNumbersResponse + } + return nil +} + +func (m *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse { + if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_ListServicesResponse); ok { + return x.ListServicesResponse + } + return nil +} + +func (m *ServerReflectionResponse) GetErrorResponse() *ErrorResponse { + if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_ErrorResponse); ok { + return x.ErrorResponse + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ServerReflectionResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ServerReflectionResponse_OneofMarshaler, _ServerReflectionResponse_OneofUnmarshaler, _ServerReflectionResponse_OneofSizer, []interface{}{ + (*ServerReflectionResponse_FileDescriptorResponse)(nil), + (*ServerReflectionResponse_AllExtensionNumbersResponse)(nil), + (*ServerReflectionResponse_ListServicesResponse)(nil), + (*ServerReflectionResponse_ErrorResponse)(nil), + } +} + +func _ServerReflectionResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ServerReflectionResponse) + // message_response + switch x := m.MessageResponse.(type) { + case *ServerReflectionResponse_FileDescriptorResponse: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.FileDescriptorResponse); err != nil { + return err + } + case *ServerReflectionResponse_AllExtensionNumbersResponse: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.AllExtensionNumbersResponse); err != nil { + return err + } + case *ServerReflectionResponse_ListServicesResponse: + b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ListServicesResponse); err != nil { + return err + } + case *ServerReflectionResponse_ErrorResponse: + b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ErrorResponse); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("ServerReflectionResponse.MessageResponse has unexpected type %T", x) + } + return nil +} + +func _ServerReflectionResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ServerReflectionResponse) + switch tag { + case 4: // message_response.file_descriptor_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(FileDescriptorResponse) + err := b.DecodeMessage(msg) + m.MessageResponse = &ServerReflectionResponse_FileDescriptorResponse{msg} + return true, err + case 5: // message_response.all_extension_numbers_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ExtensionNumberResponse) + err := b.DecodeMessage(msg) + m.MessageResponse = &ServerReflectionResponse_AllExtensionNumbersResponse{msg} + return true, err + case 6: // message_response.list_services_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ListServiceResponse) + err := b.DecodeMessage(msg) + m.MessageResponse = &ServerReflectionResponse_ListServicesResponse{msg} + return true, err + case 7: // message_response.error_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ErrorResponse) + err := b.DecodeMessage(msg) + m.MessageResponse = &ServerReflectionResponse_ErrorResponse{msg} + return true, err + default: + return false, nil + } +} + +func _ServerReflectionResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ServerReflectionResponse) + // message_response + switch x := m.MessageResponse.(type) { + case *ServerReflectionResponse_FileDescriptorResponse: + s := proto.Size(x.FileDescriptorResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerReflectionResponse_AllExtensionNumbersResponse: + s := proto.Size(x.AllExtensionNumbersResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerReflectionResponse_ListServicesResponse: + s := proto.Size(x.ListServicesResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerReflectionResponse_ErrorResponse: + s := proto.Size(x.ErrorResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +type FileDescriptorResponse struct { + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorResponse) Reset() { *m = FileDescriptorResponse{} } +func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorResponse) ProtoMessage() {} +func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{3} +} +func (m *FileDescriptorResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorResponse.Unmarshal(m, b) +} +func (m *FileDescriptorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorResponse.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorResponse.Merge(dst, src) +} +func (m *FileDescriptorResponse) XXX_Size() int { + return xxx_messageInfo_FileDescriptorResponse.Size(m) +} +func (m *FileDescriptorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorResponse proto.InternalMessageInfo + +func (m *FileDescriptorResponse) GetFileDescriptorProto() [][]byte { + if m != nil { + return m.FileDescriptorProto + } + return nil +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +type ExtensionNumberResponse struct { + // Full name of the base type, including the package name. The format + // is <package>.<type> + BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName" json:"base_type_name,omitempty"` + ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber" json:"extension_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionNumberResponse) Reset() { *m = ExtensionNumberResponse{} } +func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) } +func (*ExtensionNumberResponse) ProtoMessage() {} +func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{4} +} +func (m *ExtensionNumberResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionNumberResponse.Unmarshal(m, b) +} +func (m *ExtensionNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionNumberResponse.Marshal(b, m, deterministic) +} +func (dst *ExtensionNumberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionNumberResponse.Merge(dst, src) +} +func (m *ExtensionNumberResponse) XXX_Size() int { + return xxx_messageInfo_ExtensionNumberResponse.Size(m) +} +func (m *ExtensionNumberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionNumberResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionNumberResponse proto.InternalMessageInfo + +func (m *ExtensionNumberResponse) GetBaseTypeName() string { + if m != nil { + return m.BaseTypeName + } + return "" +} + +func (m *ExtensionNumberResponse) GetExtensionNumber() []int32 { + if m != nil { + return m.ExtensionNumber + } + return nil +} + +// A list of ServiceResponse sent by the server answering list_services request. +type ListServiceResponse struct { + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service" json:"service,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListServiceResponse) Reset() { *m = ListServiceResponse{} } +func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ListServiceResponse) ProtoMessage() {} +func (*ListServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{5} +} +func (m *ListServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListServiceResponse.Unmarshal(m, b) +} +func (m *ListServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListServiceResponse.Marshal(b, m, deterministic) +} +func (dst *ListServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListServiceResponse.Merge(dst, src) +} +func (m *ListServiceResponse) XXX_Size() int { + return xxx_messageInfo_ListServiceResponse.Size(m) +} +func (m *ListServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListServiceResponse proto.InternalMessageInfo + +func (m *ListServiceResponse) GetService() []*ServiceResponse { + if m != nil { + return m.Service + } + return nil +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +type ServiceResponse struct { + // Full name of a registered service, including its package name. The format + // is <package>.<service> + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceResponse) Reset() { *m = ServiceResponse{} } +func (m *ServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ServiceResponse) ProtoMessage() {} +func (*ServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{6} +} +func (m *ServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceResponse.Unmarshal(m, b) +} +func (m *ServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceResponse.Marshal(b, m, deterministic) +} +func (dst *ServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceResponse.Merge(dst, src) +} +func (m *ServiceResponse) XXX_Size() int { + return xxx_messageInfo_ServiceResponse.Size(m) +} +func (m *ServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceResponse proto.InternalMessageInfo + +func (m *ServiceResponse) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// The error code and error message sent by the server when an error occurs. +type ErrorResponse struct { + // This field uses the error codes defined in grpc::StatusCode. + ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode" json:"error_code,omitempty"` + ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage" json:"error_message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ErrorResponse) Reset() { *m = ErrorResponse{} } +func (m *ErrorResponse) String() string { return proto.CompactTextString(m) } +func (*ErrorResponse) ProtoMessage() {} +func (*ErrorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_reflection_178bd1e101bf8b63, []int{7} +} +func (m *ErrorResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ErrorResponse.Unmarshal(m, b) +} +func (m *ErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ErrorResponse.Marshal(b, m, deterministic) +} +func (dst *ErrorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ErrorResponse.Merge(dst, src) +} +func (m *ErrorResponse) XXX_Size() int { + return xxx_messageInfo_ErrorResponse.Size(m) +} +func (m *ErrorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ErrorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ErrorResponse proto.InternalMessageInfo + +func (m *ErrorResponse) GetErrorCode() int32 { + if m != nil { + return m.ErrorCode + } + return 0 +} + +func (m *ErrorResponse) GetErrorMessage() string { + if m != nil { + return m.ErrorMessage + } + return "" +} + +func init() { + proto.RegisterType((*ServerReflectionRequest)(nil), "grpc.reflection.v1alpha.ServerReflectionRequest") + proto.RegisterType((*ExtensionRequest)(nil), "grpc.reflection.v1alpha.ExtensionRequest") + proto.RegisterType((*ServerReflectionResponse)(nil), "grpc.reflection.v1alpha.ServerReflectionResponse") + proto.RegisterType((*FileDescriptorResponse)(nil), "grpc.reflection.v1alpha.FileDescriptorResponse") + proto.RegisterType((*ExtensionNumberResponse)(nil), "grpc.reflection.v1alpha.ExtensionNumberResponse") + proto.RegisterType((*ListServiceResponse)(nil), "grpc.reflection.v1alpha.ListServiceResponse") + proto.RegisterType((*ServiceResponse)(nil), "grpc.reflection.v1alpha.ServiceResponse") + proto.RegisterType((*ErrorResponse)(nil), "grpc.reflection.v1alpha.ErrorResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for ServerReflection service + +type ServerReflectionClient interface { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) +} + +type serverReflectionClient struct { + cc *grpc.ClientConn +} + +func NewServerReflectionClient(cc *grpc.ClientConn) ServerReflectionClient { + return &serverReflectionClient{cc} +} + +func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) { + stream, err := grpc.NewClientStream(ctx, &_ServerReflection_serviceDesc.Streams[0], c.cc, "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", opts...) + if err != nil { + return nil, err + } + x := &serverReflectionServerReflectionInfoClient{stream} + return x, nil +} + +type ServerReflection_ServerReflectionInfoClient interface { + Send(*ServerReflectionRequest) error + Recv() (*ServerReflectionResponse, error) + grpc.ClientStream +} + +type serverReflectionServerReflectionInfoClient struct { + grpc.ClientStream +} + +func (x *serverReflectionServerReflectionInfoClient) Send(m *ServerReflectionRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) { + m := new(ServerReflectionResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for ServerReflection service + +type ServerReflectionServer interface { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error +} + +func RegisterServerReflectionServer(s *grpc.Server, srv ServerReflectionServer) { + s.RegisterService(&_ServerReflection_serviceDesc, srv) +} + +func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ServerReflectionServer).ServerReflectionInfo(&serverReflectionServerReflectionInfoServer{stream}) +} + +type ServerReflection_ServerReflectionInfoServer interface { + Send(*ServerReflectionResponse) error + Recv() (*ServerReflectionRequest, error) + grpc.ServerStream +} + +type serverReflectionServerReflectionInfoServer struct { + grpc.ServerStream +} + +func (x *serverReflectionServerReflectionInfoServer) Send(m *ServerReflectionResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *serverReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) { + m := new(ServerReflectionRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _ServerReflection_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.reflection.v1alpha.ServerReflection", + HandlerType: (*ServerReflectionServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ServerReflectionInfo", + Handler: _ServerReflection_ServerReflectionInfo_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "grpc_reflection_v1alpha/reflection.proto", +} + +func init() { + proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor_reflection_178bd1e101bf8b63) +} + +var fileDescriptor_reflection_178bd1e101bf8b63 = []byte{ + // 656 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x73, 0xd2, 0x40, + 0x10, 0x6e, 0x5a, 0x68, 0x87, 0x85, 0x02, 0x5e, 0x2b, 0xa4, 0x3a, 0x75, 0x98, 0x68, 0x35, 0x75, + 0x1c, 0xda, 0xe2, 0x8c, 0x3f, 0x80, 0xaa, 0x83, 0x33, 0xb5, 0x75, 0x0e, 0x5f, 0x1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0x3e, 0x42, 0xf2, 0x18, 0x22, 0x41, 0x58, 0xac, 0x82, 0x3e, 0xbb, 0x12, 0xad, 0x68, 0xf0, 0x7d, + 0x84, 0x75, 0x7e, 0x19, 0x50, 0xcf, 0x9e, 0x1b, 0xf9, 0x09, 0xfb, 0x59, 0xec, 0x9d, 0x3f, 0xe6, + 0xe4, 0xce, 0x17, 0xfb, 0xe0, 0xec, 0x0e, 0x15, 0xd1, 0x54, 0xb6, 0x71, 0x6a, 0x0c, 0xb6, 0xb5, + 0xf4, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x85, 0x02, 0x09, 0x9d, 0x9f, 0x06, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection.go b/vendor/google.golang.org/grpc/reflection/serverreflection.go new file mode 100644 index 0000000000000000000000000000000000000000..dd22a2da78496cd3b14ac45483ecc4c1ac094a80 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/serverreflection.go @@ -0,0 +1,454 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * 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. + * + */ + +//go:generate protoc --go_out=plugins=grpc:. grpc_reflection_v1alpha/reflection.proto + +/* +Package reflection implements server reflection service. + +The service implemented is defined in: +https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. + +To register server reflection on a gRPC server: + import "google.golang.org/grpc/reflection" + + s := grpc.NewServer() + pb.RegisterYourOwnServer(s, &server{}) + + // Register reflection service on gRPC server. + reflection.Register(s) + + s.Serve(lis) + +*/ +package reflection // import "google.golang.org/grpc/reflection" + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "reflect" + "sort" + "sync" + + "github.com/golang/protobuf/proto" + dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" + "google.golang.org/grpc/status" +) + +type serverReflectionServer struct { + s *grpc.Server + + initSymbols sync.Once + serviceNames []string + symbols map[string]*dpb.FileDescriptorProto // map of fully-qualified names to files +} + +// Register registers the server reflection service on the given gRPC server. +func Register(s *grpc.Server) { + rpb.RegisterServerReflectionServer(s, &serverReflectionServer{ + s: s, + }) +} + +// protoMessage is used for type assertion on proto messages. +// Generated proto message implements function Descriptor(), but Descriptor() +// is not part of interface proto.Message. This interface is needed to +// call Descriptor(). +type protoMessage interface { + Descriptor() ([]byte, []int) +} + +func (s *serverReflectionServer) getSymbols() (svcNames []string, symbolIndex map[string]*dpb.FileDescriptorProto) { + s.initSymbols.Do(func() { + serviceInfo := s.s.GetServiceInfo() + + s.symbols = map[string]*dpb.FileDescriptorProto{} + s.serviceNames = make([]string, 0, len(serviceInfo)) + processed := map[string]struct{}{} + for svc, info := range serviceInfo { + s.serviceNames = append(s.serviceNames, svc) + fdenc, ok := parseMetadata(info.Metadata) + if !ok { + continue + } + fd, err := decodeFileDesc(fdenc) + if err != nil { + continue + } + s.processFile(fd, processed) + } + sort.Strings(s.serviceNames) + }) + + return s.serviceNames, s.symbols +} + +func (s *serverReflectionServer) processFile(fd *dpb.FileDescriptorProto, processed map[string]struct{}) { + filename := fd.GetName() + if _, ok := processed[filename]; ok { + return + } + processed[filename] = struct{}{} + + prefix := fd.GetPackage() + + for _, msg := range fd.MessageType { + s.processMessage(fd, prefix, msg) + } + for _, en := range fd.EnumType { + s.processEnum(fd, prefix, en) + } + for _, ext := range fd.Extension { + s.processField(fd, prefix, ext) + } + for _, svc := range fd.Service { + svcName := fqn(prefix, svc.GetName()) + s.symbols[svcName] = fd + for _, meth := range svc.Method { + name := fqn(svcName, meth.GetName()) + s.symbols[name] = fd + } + } + + for _, dep := range fd.Dependency { + fdenc := proto.FileDescriptor(dep) + fdDep, err := decodeFileDesc(fdenc) + if err != nil { + continue + } + s.processFile(fdDep, processed) + } +} + +func (s *serverReflectionServer) processMessage(fd *dpb.FileDescriptorProto, prefix string, msg *dpb.DescriptorProto) { + msgName := fqn(prefix, msg.GetName()) + s.symbols[msgName] = fd + + for _, nested := range msg.NestedType { + s.processMessage(fd, msgName, nested) + } + for _, en := range msg.EnumType { + s.processEnum(fd, msgName, en) + } + for _, ext := range msg.Extension { + s.processField(fd, msgName, ext) + } + for _, fld := range msg.Field { + s.processField(fd, msgName, fld) + } + for _, oneof := range msg.OneofDecl { + oneofName := fqn(msgName, oneof.GetName()) + s.symbols[oneofName] = fd + } +} + +func (s *serverReflectionServer) processEnum(fd *dpb.FileDescriptorProto, prefix string, en *dpb.EnumDescriptorProto) { + enName := fqn(prefix, en.GetName()) + s.symbols[enName] = fd + + for _, val := range en.Value { + valName := fqn(enName, val.GetName()) + s.symbols[valName] = fd + } +} + +func (s *serverReflectionServer) processField(fd *dpb.FileDescriptorProto, prefix string, fld *dpb.FieldDescriptorProto) { + fldName := fqn(prefix, fld.GetName()) + s.symbols[fldName] = fd +} + +func fqn(prefix, name string) string { + if prefix == "" { + return name + } + return prefix + "." + name +} + +// fileDescForType gets the file descriptor for the given type. +// The given type should be a proto message. +func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) { + m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage) + if !ok { + return nil, fmt.Errorf("failed to create message from type: %v", st) + } + enc, _ := m.Descriptor() + + return decodeFileDesc(enc) +} + +// decodeFileDesc does decompression and unmarshalling on the given +// file descriptor byte slice. +func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) { + raw, err := decompress(enc) + if err != nil { + return nil, fmt.Errorf("failed to decompress enc: %v", err) + } + + fd := new(dpb.FileDescriptorProto) + if err := proto.Unmarshal(raw, fd); err != nil { + return nil, fmt.Errorf("bad descriptor: %v", err) + } + return fd, nil +} + +// decompress does gzip decompression. +func decompress(b []byte) ([]byte, error) { + r, err := gzip.NewReader(bytes.NewReader(b)) + if err != nil { + return nil, fmt.Errorf("bad gzipped descriptor: %v", err) + } + out, err := ioutil.ReadAll(r) + if err != nil { + return nil, fmt.Errorf("bad gzipped descriptor: %v", err) + } + return out, nil +} + +func typeForName(name string) (reflect.Type, error) { + pt := proto.MessageType(name) + if pt == nil { + return nil, fmt.Errorf("unknown type: %q", name) + } + st := pt.Elem() + + return st, nil +} + +func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) { + m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message) + if !ok { + return nil, fmt.Errorf("failed to create message from type: %v", st) + } + + var extDesc *proto.ExtensionDesc + for id, desc := range proto.RegisteredExtensions(m) { + if id == ext { + extDesc = desc + break + } + } + + if extDesc == nil { + return nil, fmt.Errorf("failed to find registered extension for extension number %v", ext) + } + + return decodeFileDesc(proto.FileDescriptor(extDesc.Filename)) +} + +func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) { + m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message) + if !ok { + return nil, fmt.Errorf("failed to create message from type: %v", st) + } + + exts := proto.RegisteredExtensions(m) + out := make([]int32, 0, len(exts)) + for id := range exts { + out = append(out, id) + } + return out, nil +} + +// fileDescEncodingByFilename finds the file descriptor for given filename, +// does marshalling on it and returns the marshalled result. +func (s *serverReflectionServer) fileDescEncodingByFilename(name string) ([]byte, error) { + enc := proto.FileDescriptor(name) + if enc == nil { + return nil, fmt.Errorf("unknown file: %v", name) + } + fd, err := decodeFileDesc(enc) + if err != nil { + return nil, err + } + return proto.Marshal(fd) +} + +// parseMetadata finds the file descriptor bytes specified meta. +// For SupportPackageIsVersion4, m is the name of the proto file, we +// call proto.FileDescriptor to get the byte slice. +// For SupportPackageIsVersion3, m is a byte slice itself. +func parseMetadata(meta interface{}) ([]byte, bool) { + // Check if meta is the file name. + if fileNameForMeta, ok := meta.(string); ok { + return proto.FileDescriptor(fileNameForMeta), true + } + + // Check if meta is the byte slice. + if enc, ok := meta.([]byte); ok { + return enc, true + } + + return nil, false +} + +// fileDescEncodingContainingSymbol finds the file descriptor containing the given symbol, +// does marshalling on it and returns the marshalled result. +// The given symbol can be a type, a service or a method. +func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) ([]byte, error) { + _, symbols := s.getSymbols() + fd := symbols[name] + if fd == nil { + // Check if it's a type name that was not present in the + // transitive dependencies of the registered services. + if st, err := typeForName(name); err == nil { + fd, err = s.fileDescForType(st) + if err != nil { + return nil, err + } + } + } + + if fd == nil { + return nil, fmt.Errorf("unknown symbol: %v", name) + } + + return proto.Marshal(fd) +} + +// fileDescEncodingContainingExtension finds the file descriptor containing given extension, +// does marshalling on it and returns the marshalled result. +func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName string, extNum int32) ([]byte, error) { + st, err := typeForName(typeName) + if err != nil { + return nil, err + } + fd, err := fileDescContainingExtension(st, extNum) + if err != nil { + return nil, err + } + return proto.Marshal(fd) +} + +// allExtensionNumbersForTypeName returns all extension numbers for the given type. +func (s *serverReflectionServer) allExtensionNumbersForTypeName(name string) ([]int32, error) { + st, err := typeForName(name) + if err != nil { + return nil, err + } + extNums, err := s.allExtensionNumbersForType(st) + if err != nil { + return nil, err + } + return extNums, nil +} + +// ServerReflectionInfo is the reflection service handler. +func (s *serverReflectionServer) ServerReflectionInfo(stream rpb.ServerReflection_ServerReflectionInfoServer) error { + for { + in, err := stream.Recv() + if err == io.EOF { + return nil + } + if err != nil { + return err + } + + out := &rpb.ServerReflectionResponse{ + ValidHost: in.Host, + OriginalRequest: in, + } + switch req := in.MessageRequest.(type) { + case *rpb.ServerReflectionRequest_FileByFilename: + b, err := s.fileDescEncodingByFilename(req.FileByFilename) + if err != nil { + out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &rpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: [][]byte{b}}, + } + } + case *rpb.ServerReflectionRequest_FileContainingSymbol: + b, err := s.fileDescEncodingContainingSymbol(req.FileContainingSymbol) + if err != nil { + out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &rpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: [][]byte{b}}, + } + } + case *rpb.ServerReflectionRequest_FileContainingExtension: + typeName := req.FileContainingExtension.ContainingType + extNum := req.FileContainingExtension.ExtensionNumber + b, err := s.fileDescEncodingContainingExtension(typeName, extNum) + if err != nil { + out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &rpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: [][]byte{b}}, + } + } + case *rpb.ServerReflectionRequest_AllExtensionNumbersOfType: + extNums, err := s.allExtensionNumbersForTypeName(req.AllExtensionNumbersOfType) + if err != nil { + out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &rpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &rpb.ServerReflectionResponse_AllExtensionNumbersResponse{ + AllExtensionNumbersResponse: &rpb.ExtensionNumberResponse{ + BaseTypeName: req.AllExtensionNumbersOfType, + ExtensionNumber: extNums, + }, + } + } + case *rpb.ServerReflectionRequest_ListServices: + svcNames, _ := s.getSymbols() + serviceResponses := make([]*rpb.ServiceResponse, len(svcNames)) + for i, n := range svcNames { + serviceResponses[i] = &rpb.ServiceResponse{ + Name: n, + } + } + out.MessageResponse = &rpb.ServerReflectionResponse_ListServicesResponse{ + ListServicesResponse: &rpb.ListServiceResponse{ + Service: serviceResponses, + }, + } + default: + return status.Errorf(codes.InvalidArgument, "invalid MessageRequest: %v", in.MessageRequest) + } + + if err := stream.Send(out); err != nil { + return err + } + } +}