mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 05:42:25 -05:00 
			
		
		
		
	[chore] Bump otel deps -> v1.30.0/v0.52.0 (#3307)
This commit is contained in:
		
					parent
					
						
							
								9046220979
							
						
					
				
			
			
				commit
				
					
						b2572b9e07
					
				
			
		
					 97 changed files with 3438 additions and 1645 deletions
				
			
		
							
								
								
									
										69
									
								
								vendor/google.golang.org/grpc/codec.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										69
									
								
								vendor/google.golang.org/grpc/codec.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -21,18 +21,73 @@ package grpc | |||
| import ( | ||||
| 	"google.golang.org/grpc/encoding" | ||||
| 	_ "google.golang.org/grpc/encoding/proto" // to register the Codec for "proto" | ||||
| 	"google.golang.org/grpc/mem" | ||||
| ) | ||||
| 
 | ||||
| // baseCodec contains the functionality of both Codec and encoding.Codec, but | ||||
| // omits the name/string, which vary between the two and are not needed for | ||||
| // anything besides the registry in the encoding package. | ||||
| // baseCodec captures the new encoding.CodecV2 interface without the Name | ||||
| // function, allowing it to be implemented by older Codec and encoding.Codec | ||||
| // implementations. The omitted Name function is only needed for the register in | ||||
| // the encoding package and is not part of the core functionality. | ||||
| type baseCodec interface { | ||||
| 	Marshal(v any) ([]byte, error) | ||||
| 	Unmarshal(data []byte, v any) error | ||||
| 	Marshal(v any) (mem.BufferSlice, error) | ||||
| 	Unmarshal(data mem.BufferSlice, v any) error | ||||
| } | ||||
| 
 | ||||
| var _ baseCodec = Codec(nil) | ||||
| var _ baseCodec = encoding.Codec(nil) | ||||
| // getCodec returns an encoding.CodecV2 for the codec of the given name (if | ||||
| // registered). Initially checks the V2 registry with encoding.GetCodecV2 and | ||||
| // returns the V2 codec if it is registered. Otherwise, it checks the V1 registry | ||||
| // with encoding.GetCodec and if it is registered wraps it with newCodecV1Bridge | ||||
| // to turn it into an encoding.CodecV2. Returns nil otherwise. | ||||
| func getCodec(name string) encoding.CodecV2 { | ||||
| 	if codecV1 := encoding.GetCodec(name); codecV1 != nil { | ||||
| 		return newCodecV1Bridge(codecV1) | ||||
| 	} | ||||
| 
 | ||||
| 	return encoding.GetCodecV2(name) | ||||
| } | ||||
| 
 | ||||
| func newCodecV0Bridge(c Codec) baseCodec { | ||||
| 	return codecV0Bridge{codec: c} | ||||
| } | ||||
| 
 | ||||
| func newCodecV1Bridge(c encoding.Codec) encoding.CodecV2 { | ||||
| 	return codecV1Bridge{ | ||||
| 		codecV0Bridge: codecV0Bridge{codec: c}, | ||||
| 		name:          c.Name(), | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| var _ baseCodec = codecV0Bridge{} | ||||
| 
 | ||||
| type codecV0Bridge struct { | ||||
| 	codec interface { | ||||
| 		Marshal(v any) ([]byte, error) | ||||
| 		Unmarshal(data []byte, v any) error | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func (c codecV0Bridge) Marshal(v any) (mem.BufferSlice, error) { | ||||
| 	data, err := c.codec.Marshal(v) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return mem.BufferSlice{mem.NewBuffer(&data, nil)}, nil | ||||
| } | ||||
| 
 | ||||
| func (c codecV0Bridge) Unmarshal(data mem.BufferSlice, v any) (err error) { | ||||
| 	return c.codec.Unmarshal(data.Materialize(), v) | ||||
| } | ||||
| 
 | ||||
| var _ encoding.CodecV2 = codecV1Bridge{} | ||||
| 
 | ||||
| type codecV1Bridge struct { | ||||
| 	codecV0Bridge | ||||
| 	name string | ||||
| } | ||||
| 
 | ||||
| func (c codecV1Bridge) Name() string { | ||||
| 	return c.name | ||||
| } | ||||
| 
 | ||||
| // Codec defines the interface gRPC uses to encode and decode messages. | ||||
| // Note that implementations of this interface must be thread safe; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue