 c857ba2d0b
			
		
	
	c857ba2d0b
	
	
	
		
			
			To ensure consistent fieldpath matching for events, we generate the fieldpath matching using protobuf definitions. This is done through a plugin called "fieldpath" that defines a `Field` method for each type with the plugin enabled. Generated code handles top-level envelope fields, as well as deferred serialization for matching any types. In practice, this means that we can cheaply match events on `topic` and `namespace`. If we want to match on attributes within the event, we can use the `event` prefix to address these fields. For example, the following will match all envelopes that have a field named `container_id` that has the value `testing`: ``` ctr events "event.container_id==testing" ``` The above will decode the underlying event and check that particular field. Accordingly, if only `topic` or `namespace` is used, the event will not be decoded and only match on the envelope. Signed-off-by: Stephen J Day <stephen.day@docker.com>
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
| // Protocol Buffers for Go with Gadgets
 | |
| //
 | |
| // Copyright (c) 2013, The GoGo Authors. All rights reserved.
 | |
| // http://github.com/gogo/protobuf
 | |
| //
 | |
| // Redistribution and use in source and binary forms, with or without
 | |
| // modification, are permitted provided that the following conditions are
 | |
| // met:
 | |
| //
 | |
| //     * Redistributions of source code must retain the above copyright
 | |
| // notice, this list of conditions and the following disclaimer.
 | |
| //     * Redistributions in binary form must reproduce the above
 | |
| // copyright notice, this list of conditions and the following disclaimer
 | |
| // in the documentation and/or other materials provided with the
 | |
| // distribution.
 | |
| //
 | |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | |
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | |
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 | |
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 | |
| // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | |
| // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 | |
| // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 | |
| // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 | |
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | |
| 
 | |
| syntax = "proto2";
 | |
| package containerd.plugin;
 | |
| 
 | |
| import "google/protobuf/descriptor.proto";
 | |
| 
 | |
| extend google.protobuf.FileOptions {
 | |
| 	optional bool fieldpath_all = 63300;
 | |
| }
 | |
| 
 | |
| extend google.protobuf.MessageOptions {
 | |
| 	optional bool fieldpath = 64400;
 | |
| }
 |