query_docstring
stringlengths
24
20.8k
positive_code
stringlengths
17
325k
hard_negative_code
stringlengths
17
325k
similarity_score
float64
0.3
1
query_repo
stringclasses
407 values
query_path
stringlengths
5
170
hn_repo
stringclasses
400 values
hn_path
stringlengths
5
170
hn_license
stringclasses
4 values
language
stringclasses
1 value
PostHTTPListenerModify is called after Envoy Gateway is done generating a Listener xDS configuration and before that configuration is passed on to Envoy Proxy. This example adds Basic Authentication on the Listener level as an example. Note: This implementation is not secure, and should not be used to protect anything important.
func (s *Server) PostHTTPListenerModify(ctx context.Context, req *pb.PostHTTPListenerModifyRequest) (*pb.PostHTTPListenerModifyResponse, error) { s.log.Info("postHTTPListenerModify callback was invoked") // Collect all of the required username/password combinations from the // provided contexts that were attached to the gateway. passwords := NewHtpasswd() for _, ext := range req.PostListenerContext.ExtensionResources { var listenerContext v1alpha1.ListenerContextExample if err := json.Unmarshal(ext.GetUnstructuredBytes(), &listenerContext); err != nil { s.log.Error("failed to unmarshal the extension", slog.String("error", err.Error())) continue } s.log.Info("processing an extension context", slog.String("username", listenerContext.Spec.Username)) passwords.AddUser(listenerContext.Spec.Username, listenerContext.Spec.Password) } // First, get the filter chains from the listener filterChains := req.Listener.GetFilterChains() defaultFC := req.Listener.DefaultFilterChain if defaultFC != nil { filterChains = append(filterChains, defaultFC) } // Go over all of the chains, and add the basic authentication http filter for _, currChain := range filterChains { httpConManager, hcmIndex, err := findHCM(currChain) if err != nil { s.log.Error("failed to find an HCM in the current chain", slog.Any("error", err)) continue } // If a basic authentication filter already exists, update it. Otherwise, create it. basicAuth, baIndex, err := findBasicAuthFilter(httpConManager.HttpFilters) if err != nil { s.log.Error("failed to unmarshal the existing basicAuth filter", slog.Any("error", err)) continue } if baIndex == -1 { // Create a new basic auth filter basicAuth = &bav3.BasicAuth{ Users: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ InlineString: passwords.String(), }, }, ForwardUsernameHeader: "X-Example-Ext", } } else { // Update the basic auth filter basicAuth.Users.Specifier = &corev3.DataSource_InlineString{ InlineString: passwords.String(), } } // Add or update the Basic Authentication filter in the HCM anyBAFilter, _ := anypb.New(basicAuth) if baIndex > -1 { httpConManager.HttpFilters[baIndex].ConfigType = &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, } } else { filters := []*hcm.HttpFilter{ { Name: "envoy.filters.http.basic_auth", ConfigType: &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, }, }, } filters = append(filters, httpConManager.HttpFilters...) httpConManager.HttpFilters = filters } // Write the updated HCM back to the filter chain anyConnectionMgr, _ := anypb.New(httpConManager) currChain.Filters[hcmIndex].ConfigType = &listenerv3.Filter_TypedConfig{ TypedConfig: anyConnectionMgr, } } return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, nil }
func (t *testingExtensionServer) PostHTTPListenerModify(_ context.Context, req *pb.PostHTTPListenerModifyRequest) (*pb.PostHTTPListenerModifyResponse, error) { // Only make the change when the listener's name matches the expected testdata // This prevents us from having to update every single testfile.out switch req.Listener.Name { case "extension-post-xdslistener-hook-error": return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, fmt.Errorf("extension post xds listener hook error") case "extension-listener": // Setup a new Listener to avoid operating directly on the passed in pointer for better test coverage that the // Listener we are returning gets used properly modifiedListener := proto.Clone(req.Listener).(*listenerV3.Listener) modifiedListener.StatPrefix = "mock-extension-inserted-prefix" return &pb.PostHTTPListenerModifyResponse{ Listener: modifiedListener, }, nil case "policyextension-listener": if len(req.PostListenerContext.ExtensionResources) == 0 { return nil, fmt.Errorf("expected a policy in the ext array") } extensionResource := unstructured.Unstructured{} if err := extensionResource.UnmarshalJSON(req.PostListenerContext.ExtensionResources[0].UnstructuredBytes); err != nil { return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, err } spec, ok := extensionResource.Object["spec"].(map[string]any) if !ok { return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, fmt.Errorf("can't find the spec section") } data, ok := spec["data"].(string) if !ok { return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, fmt.Errorf("can't find the expected information") } modifiedListener := proto.Clone(req.Listener).(*listenerV3.Listener) modifiedListener.StatPrefix = data return &pb.PostHTTPListenerModifyResponse{ Listener: modifiedListener, }, nil case "envoy-gateway/gateway-1/http1": if len(req.PostListenerContext.ExtensionResources) != 1 { return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, fmt.Errorf("received %d extension policies when expecting 1: %s", len(req.PostListenerContext.ExtensionResources), req.Listener.Name) } modifiedListener := proto.Clone(req.Listener).(*listenerV3.Listener) modifiedListener.StatPrefix = req.Listener.Name return &pb.PostHTTPListenerModifyResponse{ Listener: modifiedListener, }, nil case "envoy-gateway/gateway-1/tcp1": return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, fmt.Errorf("should not be called for this listener, test 'extensionpolicy-tcp-and-http' should merge tcp and http gateways to one listener") case "envoy-gateway/gateway-1/udp1": if len(req.PostListenerContext.ExtensionResources) != 1 { return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, fmt.Errorf("received %d extension policies when expecting 1: %s", len(req.PostListenerContext.ExtensionResources), req.Listener.Name) } modifiedListener := proto.Clone(req.Listener).(*listenerV3.Listener) modifiedListener.StatPrefix = req.Listener.Name return &pb.PostHTTPListenerModifyResponse{ Listener: modifiedListener, }, nil case "first-listener-error": modifiedListener := proto.Clone(req.Listener).(*listenerV3.Listener) modifiedListener.StatPrefix = req.Listener.Name return &pb.PostHTTPListenerModifyResponse{ Listener: modifiedListener, }, fmt.Errorf("simulate error when there is no default filter chain in the original resources") } return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, nil }
0.713937
envoyproxy/gateway
examples/extension-server/internal/extensionserver/server.go
envoyproxy/gateway
internal/xds/translator/extensionserver_test.go
Apache-2.0
go
PostHTTPListenerModify is called after Envoy Gateway is done generating a Listener xDS configuration and before that configuration is passed on to Envoy Proxy. This example adds Basic Authentication on the Listener level as an example. Note: This implementation is not secure, and should not be used to protect anything important.
func (s *Server) PostHTTPListenerModify(ctx context.Context, req *pb.PostHTTPListenerModifyRequest) (*pb.PostHTTPListenerModifyResponse, error) { s.log.Info("postHTTPListenerModify callback was invoked") // Collect all of the required username/password combinations from the // provided contexts that were attached to the gateway. passwords := NewHtpasswd() for _, ext := range req.PostListenerContext.ExtensionResources { var listenerContext v1alpha1.ListenerContextExample if err := json.Unmarshal(ext.GetUnstructuredBytes(), &listenerContext); err != nil { s.log.Error("failed to unmarshal the extension", slog.String("error", err.Error())) continue } s.log.Info("processing an extension context", slog.String("username", listenerContext.Spec.Username)) passwords.AddUser(listenerContext.Spec.Username, listenerContext.Spec.Password) } // First, get the filter chains from the listener filterChains := req.Listener.GetFilterChains() defaultFC := req.Listener.DefaultFilterChain if defaultFC != nil { filterChains = append(filterChains, defaultFC) } // Go over all of the chains, and add the basic authentication http filter for _, currChain := range filterChains { httpConManager, hcmIndex, err := findHCM(currChain) if err != nil { s.log.Error("failed to find an HCM in the current chain", slog.Any("error", err)) continue } // If a basic authentication filter already exists, update it. Otherwise, create it. basicAuth, baIndex, err := findBasicAuthFilter(httpConManager.HttpFilters) if err != nil { s.log.Error("failed to unmarshal the existing basicAuth filter", slog.Any("error", err)) continue } if baIndex == -1 { // Create a new basic auth filter basicAuth = &bav3.BasicAuth{ Users: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ InlineString: passwords.String(), }, }, ForwardUsernameHeader: "X-Example-Ext", } } else { // Update the basic auth filter basicAuth.Users.Specifier = &corev3.DataSource_InlineString{ InlineString: passwords.String(), } } // Add or update the Basic Authentication filter in the HCM anyBAFilter, _ := anypb.New(basicAuth) if baIndex > -1 { httpConManager.HttpFilters[baIndex].ConfigType = &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, } } else { filters := []*hcm.HttpFilter{ { Name: "envoy.filters.http.basic_auth", ConfigType: &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, }, }, } filters = append(filters, httpConManager.HttpFilters...) httpConManager.HttpFilters = filters } // Write the updated HCM back to the filter chain anyConnectionMgr, _ := anypb.New(httpConManager) currChain.Filters[hcmIndex].ConfigType = &listenerv3.Filter_TypedConfig{ TypedConfig: anyConnectionMgr, } } return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, nil }
func (*basicAuth) patchHCM(mgr *hcmv3.HttpConnectionManager, irListener *ir.HTTPListener) error { if mgr == nil { return errors.New("hcm is nil") } if irListener == nil { return errors.New("ir listener is nil") } var errs error for _, route := range irListener.Routes { if route.Security == nil || route.Security.BasicAuth == nil { continue } // Only generates one Basic Auth Envoy filter for each unique name. // For example, if there are two routes under the same gateway with the // same BasicAuth config, only one BasicAuth filter will be generated. if hcmContainsFilter(mgr, basicAuthFilterName(route.Security.BasicAuth)) { continue } filter, err := buildHCMBasicAuthFilter(route.Security.BasicAuth) if err != nil { errs = errors.Join(errs, err) continue } mgr.HttpFilters = append(mgr.HttpFilters, filter) } return errs }
0.551244
envoyproxy/gateway
examples/extension-server/internal/extensionserver/server.go
envoyproxy/gateway
internal/xds/translator/basicauth.go
Apache-2.0
go
PostHTTPListenerModify is called after Envoy Gateway is done generating a Listener xDS configuration and before that configuration is passed on to Envoy Proxy. This example adds Basic Authentication on the Listener level as an example. Note: This implementation is not secure, and should not be used to protect anything important.
func (s *Server) PostHTTPListenerModify(ctx context.Context, req *pb.PostHTTPListenerModifyRequest) (*pb.PostHTTPListenerModifyResponse, error) { s.log.Info("postHTTPListenerModify callback was invoked") // Collect all of the required username/password combinations from the // provided contexts that were attached to the gateway. passwords := NewHtpasswd() for _, ext := range req.PostListenerContext.ExtensionResources { var listenerContext v1alpha1.ListenerContextExample if err := json.Unmarshal(ext.GetUnstructuredBytes(), &listenerContext); err != nil { s.log.Error("failed to unmarshal the extension", slog.String("error", err.Error())) continue } s.log.Info("processing an extension context", slog.String("username", listenerContext.Spec.Username)) passwords.AddUser(listenerContext.Spec.Username, listenerContext.Spec.Password) } // First, get the filter chains from the listener filterChains := req.Listener.GetFilterChains() defaultFC := req.Listener.DefaultFilterChain if defaultFC != nil { filterChains = append(filterChains, defaultFC) } // Go over all of the chains, and add the basic authentication http filter for _, currChain := range filterChains { httpConManager, hcmIndex, err := findHCM(currChain) if err != nil { s.log.Error("failed to find an HCM in the current chain", slog.Any("error", err)) continue } // If a basic authentication filter already exists, update it. Otherwise, create it. basicAuth, baIndex, err := findBasicAuthFilter(httpConManager.HttpFilters) if err != nil { s.log.Error("failed to unmarshal the existing basicAuth filter", slog.Any("error", err)) continue } if baIndex == -1 { // Create a new basic auth filter basicAuth = &bav3.BasicAuth{ Users: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ InlineString: passwords.String(), }, }, ForwardUsernameHeader: "X-Example-Ext", } } else { // Update the basic auth filter basicAuth.Users.Specifier = &corev3.DataSource_InlineString{ InlineString: passwords.String(), } } // Add or update the Basic Authentication filter in the HCM anyBAFilter, _ := anypb.New(basicAuth) if baIndex > -1 { httpConManager.HttpFilters[baIndex].ConfigType = &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, } } else { filters := []*hcm.HttpFilter{ { Name: "envoy.filters.http.basic_auth", ConfigType: &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, }, }, } filters = append(filters, httpConManager.HttpFilters...) httpConManager.HttpFilters = filters } // Write the updated HCM back to the filter chain anyConnectionMgr, _ := anypb.New(httpConManager) currChain.Filters[hcmIndex].ConfigType = &listenerv3.Filter_TypedConfig{ TypedConfig: anyConnectionMgr, } } return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, nil }
func (c *ELBV2) ModifyListener(input *ModifyListenerInput) (*ModifyListenerOutput, error) { req, out := c.ModifyListenerRequest(input) return out, req.Send() }
0.546635
envoyproxy/gateway
examples/extension-server/internal/extensionserver/server.go
aws/aws-sdk-go
service/elbv2/api.go
Apache-2.0
go
PostHTTPListenerModify is called after Envoy Gateway is done generating a Listener xDS configuration and before that configuration is passed on to Envoy Proxy. This example adds Basic Authentication on the Listener level as an example. Note: This implementation is not secure, and should not be used to protect anything important.
func (s *Server) PostHTTPListenerModify(ctx context.Context, req *pb.PostHTTPListenerModifyRequest) (*pb.PostHTTPListenerModifyResponse, error) { s.log.Info("postHTTPListenerModify callback was invoked") // Collect all of the required username/password combinations from the // provided contexts that were attached to the gateway. passwords := NewHtpasswd() for _, ext := range req.PostListenerContext.ExtensionResources { var listenerContext v1alpha1.ListenerContextExample if err := json.Unmarshal(ext.GetUnstructuredBytes(), &listenerContext); err != nil { s.log.Error("failed to unmarshal the extension", slog.String("error", err.Error())) continue } s.log.Info("processing an extension context", slog.String("username", listenerContext.Spec.Username)) passwords.AddUser(listenerContext.Spec.Username, listenerContext.Spec.Password) } // First, get the filter chains from the listener filterChains := req.Listener.GetFilterChains() defaultFC := req.Listener.DefaultFilterChain if defaultFC != nil { filterChains = append(filterChains, defaultFC) } // Go over all of the chains, and add the basic authentication http filter for _, currChain := range filterChains { httpConManager, hcmIndex, err := findHCM(currChain) if err != nil { s.log.Error("failed to find an HCM in the current chain", slog.Any("error", err)) continue } // If a basic authentication filter already exists, update it. Otherwise, create it. basicAuth, baIndex, err := findBasicAuthFilter(httpConManager.HttpFilters) if err != nil { s.log.Error("failed to unmarshal the existing basicAuth filter", slog.Any("error", err)) continue } if baIndex == -1 { // Create a new basic auth filter basicAuth = &bav3.BasicAuth{ Users: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ InlineString: passwords.String(), }, }, ForwardUsernameHeader: "X-Example-Ext", } } else { // Update the basic auth filter basicAuth.Users.Specifier = &corev3.DataSource_InlineString{ InlineString: passwords.String(), } } // Add or update the Basic Authentication filter in the HCM anyBAFilter, _ := anypb.New(basicAuth) if baIndex > -1 { httpConManager.HttpFilters[baIndex].ConfigType = &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, } } else { filters := []*hcm.HttpFilter{ { Name: "envoy.filters.http.basic_auth", ConfigType: &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, }, }, } filters = append(filters, httpConManager.HttpFilters...) httpConManager.HttpFilters = filters } // Write the updated HCM back to the filter chain anyConnectionMgr, _ := anypb.New(httpConManager) currChain.Filters[hcmIndex].ConfigType = &listenerv3.Filter_TypedConfig{ TypedConfig: anyConnectionMgr, } } return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, nil }
func (s *sandwichedTranslationPass) ApplyListenerPlugin(ctx context.Context, pCtx *ir.ListenerContext, out *listenerv3.Listener) { _, ok := pCtx.Policy.(SandwichedInboundPolicy) if !ok { return } out.ListenerFilters = append(out.GetListenerFilters(), ProxyProtocolTLV) s.isSandwiched = true return }
0.514312
envoyproxy/gateway
examples/extension-server/internal/extensionserver/server.go
kgateway-dev/kgateway
internal/kgateway/extensions2/plugins/sandwich/plugin.go
Apache-2.0
go
PostHTTPListenerModify is called after Envoy Gateway is done generating a Listener xDS configuration and before that configuration is passed on to Envoy Proxy. This example adds Basic Authentication on the Listener level as an example. Note: This implementation is not secure, and should not be used to protect anything important.
func (s *Server) PostHTTPListenerModify(ctx context.Context, req *pb.PostHTTPListenerModifyRequest) (*pb.PostHTTPListenerModifyResponse, error) { s.log.Info("postHTTPListenerModify callback was invoked") // Collect all of the required username/password combinations from the // provided contexts that were attached to the gateway. passwords := NewHtpasswd() for _, ext := range req.PostListenerContext.ExtensionResources { var listenerContext v1alpha1.ListenerContextExample if err := json.Unmarshal(ext.GetUnstructuredBytes(), &listenerContext); err != nil { s.log.Error("failed to unmarshal the extension", slog.String("error", err.Error())) continue } s.log.Info("processing an extension context", slog.String("username", listenerContext.Spec.Username)) passwords.AddUser(listenerContext.Spec.Username, listenerContext.Spec.Password) } // First, get the filter chains from the listener filterChains := req.Listener.GetFilterChains() defaultFC := req.Listener.DefaultFilterChain if defaultFC != nil { filterChains = append(filterChains, defaultFC) } // Go over all of the chains, and add the basic authentication http filter for _, currChain := range filterChains { httpConManager, hcmIndex, err := findHCM(currChain) if err != nil { s.log.Error("failed to find an HCM in the current chain", slog.Any("error", err)) continue } // If a basic authentication filter already exists, update it. Otherwise, create it. basicAuth, baIndex, err := findBasicAuthFilter(httpConManager.HttpFilters) if err != nil { s.log.Error("failed to unmarshal the existing basicAuth filter", slog.Any("error", err)) continue } if baIndex == -1 { // Create a new basic auth filter basicAuth = &bav3.BasicAuth{ Users: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ InlineString: passwords.String(), }, }, ForwardUsernameHeader: "X-Example-Ext", } } else { // Update the basic auth filter basicAuth.Users.Specifier = &corev3.DataSource_InlineString{ InlineString: passwords.String(), } } // Add or update the Basic Authentication filter in the HCM anyBAFilter, _ := anypb.New(basicAuth) if baIndex > -1 { httpConManager.HttpFilters[baIndex].ConfigType = &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, } } else { filters := []*hcm.HttpFilter{ { Name: "envoy.filters.http.basic_auth", ConfigType: &hcm.HttpFilter_TypedConfig{ TypedConfig: anyBAFilter, }, }, } filters = append(filters, httpConManager.HttpFilters...) httpConManager.HttpFilters = filters } // Write the updated HCM back to the filter chain anyConnectionMgr, _ := anypb.New(httpConManager) currChain.Filters[hcmIndex].ConfigType = &listenerv3.Filter_TypedConfig{ TypedConfig: anyConnectionMgr, } } return &pb.PostHTTPListenerModifyResponse{ Listener: req.Listener, }, nil }
func (t *waypointTranslator) buildHTTPVirtualHost( ctx context.Context, baseReporter reports.Reporter, gw *ir.Gateway, gwListener *ir.Listener, svc waypointquery.Service, httpRoutes []*query.RouteInfo, ) *ir.VirtualHost { if len(httpRoutes) == 0 { return nil } var translatedRoutes []ir.HttpRouteRuleMatchIR // TODO should we do any pre-processing to HTTPRoutes? // Something like default backendRefs if empty? for _, httpRoute := range httpRoutes { parentRefReporter := baseReporter.Route(httpRoute.Object.GetSourceObject()).ParentRef(&httpRoute.ParentRef) translatedRoutes = append(translatedRoutes, httproute.TranslateGatewayHTTPRouteRules( ctx, gwListener.Listener, httpRoute, parentRefReporter, baseReporter, )...) } return &ir.VirtualHost{ Name: stringutils.TruncateMaxLength( "http_routes_"+svc.GetName()+"_"+svc.GetNamespace(), wellknown.EnvoyConfigNameMaxLen, ), Rules: translatedRoutes, Hostname: "*", // TODO not sure how this works.. will this also have sectionname-less policies? // should this also have gateway targeted policies? AttachedPolicies: gwListener.AttachedPolicies, } }
0.499061
envoyproxy/gateway
examples/extension-server/internal/extensionserver/server.go
kgateway-dev/kgateway
internal/kgateway/extensions2/plugins/waypoint/waypoint_translator.go
Apache-2.0
go
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32(p *uint32) (v uint32) { if p == nil { return v } return *p }
func ToUint(p *uint) (v uint) { if p == nil { return v } return *p }
0.889822
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
Apache-2.0
go
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32(p *uint32) (v uint32) { if p == nil { return v } return *p }
func ToUint32Slice(vs []*uint32) []uint32 { ps := make([]uint32, len(vs)) for i, v := range vs { ps[i] = ToUint32(v) } return ps }
0.879275
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
Apache-2.0
go
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32(p *uint32) (v uint32) { if p == nil { return v } return *p }
func ToUint8(p *uint8) (v uint8) { if p == nil { return v } return *p }
0.856035
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
Apache-2.0
go
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32(p *uint32) (v uint32) { if p == nil { return v } return *p }
func ToInt32(p *int32) (v int32) { if p == nil { return v } return *p }
0.845522
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
Apache-2.0
go
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32(p *uint32) (v uint32) { if p == nil { return v } return *p }
func ToUint64(p *uint64) (v uint64) { if p == nil { return v } return *p }
0.833802
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
tektoncd/cli
vendor/github.com/aws/smithy-go/ptr/from_ptr.go
Apache-2.0
go
ListCertificateProvidersRequest generates a "aws/request.Request" representing the client's request for the ListCertificateProviders operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See ListCertificateProviders for more information on using the ListCertificateProviders API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the ListCertificateProvidersRequest method. req, resp := client.ListCertificateProvidersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }
func (c *IoT) ListCertificateProvidersRequest(input *ListCertificateProvidersInput) (req *request.Request, output *ListCertificateProvidersOutput) { op := &request.Operation{ Name: opListCertificateProviders, HTTPMethod: "GET", HTTPPath: "/certificate-providers/", } if input == nil { input = &ListCertificateProvidersInput{} } output = &ListCertificateProvidersOutput{} req = c.newRequest(op, input, output) return }
func (c *IoT) ListCertificateProvidersWithContext(ctx aws.Context, input *ListCertificateProvidersInput, opts ...request.Option) (*ListCertificateProvidersOutput, error) { req, out := c.ListCertificateProvidersRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.834796
aws/aws-sdk-go
service/iot/api.go
aws/aws-sdk-go
service/iot/api.go
Apache-2.0
go
ListCertificateProvidersRequest generates a "aws/request.Request" representing the client's request for the ListCertificateProviders operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See ListCertificateProviders for more information on using the ListCertificateProviders API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the ListCertificateProvidersRequest method. req, resp := client.ListCertificateProvidersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }
func (c *IoT) ListCertificateProvidersRequest(input *ListCertificateProvidersInput) (req *request.Request, output *ListCertificateProvidersOutput) { op := &request.Operation{ Name: opListCertificateProviders, HTTPMethod: "GET", HTTPPath: "/certificate-providers/", } if input == nil { input = &ListCertificateProvidersInput{} } output = &ListCertificateProvidersOutput{} req = c.newRequest(op, input, output) return }
func (c *IoT) DescribeCertificateProviderRequest(input *DescribeCertificateProviderInput) (req *request.Request, output *DescribeCertificateProviderOutput) { op := &request.Operation{ Name: opDescribeCertificateProvider, HTTPMethod: "GET", HTTPPath: "/certificate-providers/{certificateProviderName}", } if input == nil { input = &DescribeCertificateProviderInput{} } output = &DescribeCertificateProviderOutput{} req = c.newRequest(op, input, output) return }
0.768989
aws/aws-sdk-go
service/iot/api.go
aws/aws-sdk-go
service/iot/api.go
Apache-2.0
go
ListCertificateProvidersRequest generates a "aws/request.Request" representing the client's request for the ListCertificateProviders operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See ListCertificateProviders for more information on using the ListCertificateProviders API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the ListCertificateProvidersRequest method. req, resp := client.ListCertificateProvidersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }
func (c *IoT) ListCertificateProvidersRequest(input *ListCertificateProvidersInput) (req *request.Request, output *ListCertificateProvidersOutput) { op := &request.Operation{ Name: opListCertificateProviders, HTTPMethod: "GET", HTTPPath: "/certificate-providers/", } if input == nil { input = &ListCertificateProvidersInput{} } output = &ListCertificateProvidersOutput{} req = c.newRequest(op, input, output) return }
func (c *IoT) CreateCertificateProviderRequest(input *CreateCertificateProviderInput) (req *request.Request, output *CreateCertificateProviderOutput) { op := &request.Operation{ Name: opCreateCertificateProvider, HTTPMethod: "POST", HTTPPath: "/certificate-providers/{certificateProviderName}", } if input == nil { input = &CreateCertificateProviderInput{} } output = &CreateCertificateProviderOutput{} req = c.newRequest(op, input, output) return }
0.746974
aws/aws-sdk-go
service/iot/api.go
aws/aws-sdk-go
service/iot/api.go
Apache-2.0
go
ListCertificateProvidersRequest generates a "aws/request.Request" representing the client's request for the ListCertificateProviders operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See ListCertificateProviders for more information on using the ListCertificateProviders API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the ListCertificateProvidersRequest method. req, resp := client.ListCertificateProvidersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }
func (c *IoT) ListCertificateProvidersRequest(input *ListCertificateProvidersInput) (req *request.Request, output *ListCertificateProvidersOutput) { op := &request.Operation{ Name: opListCertificateProviders, HTTPMethod: "GET", HTTPPath: "/certificate-providers/", } if input == nil { input = &ListCertificateProvidersInput{} } output = &ListCertificateProvidersOutput{} req = c.newRequest(op, input, output) return }
func (c *CognitoIdentityProvider) ListIdentityProvidersRequest(input *ListIdentityProvidersInput) (req *request.Request, output *ListIdentityProvidersOutput) { op := &request.Operation{ Name: opListIdentityProviders, HTTPMethod: "POST", HTTPPath: "/", Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", TruncationToken: "", }, } if input == nil { input = &ListIdentityProvidersInput{} } output = &ListIdentityProvidersOutput{} req = c.newRequest(op, input, output) return }
0.744537
aws/aws-sdk-go
service/iot/api.go
aws/aws-sdk-go
service/cognitoidentityprovider/api.go
Apache-2.0
go
ListCertificateProvidersRequest generates a "aws/request.Request" representing the client's request for the ListCertificateProviders operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See ListCertificateProviders for more information on using the ListCertificateProviders API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the ListCertificateProvidersRequest method. req, resp := client.ListCertificateProvidersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }
func (c *IoT) ListCertificateProvidersRequest(input *ListCertificateProvidersInput) (req *request.Request, output *ListCertificateProvidersOutput) { op := &request.Operation{ Name: opListCertificateProviders, HTTPMethod: "GET", HTTPPath: "/certificate-providers/", } if input == nil { input = &ListCertificateProvidersInput{} } output = &ListCertificateProvidersOutput{} req = c.newRequest(op, input, output) return }
func (c *IAM) ListOpenIDConnectProvidersRequest(input *ListOpenIDConnectProvidersInput) (req *request.Request, output *ListOpenIDConnectProvidersOutput) { op := &request.Operation{ Name: opListOpenIDConnectProviders, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &ListOpenIDConnectProvidersInput{} } output = &ListOpenIDConnectProvidersOutput{} req = c.newRequest(op, input, output) return }
0.74383
aws/aws-sdk-go
service/iot/api.go
aws/aws-sdk-go
service/iam/api.go
Apache-2.0
go
DescribeEdgeConfigurationRequest generates a "aws/request.Request" representing the client's request for the DescribeEdgeConfiguration operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DescribeEdgeConfiguration for more information on using the DescribeEdgeConfiguration API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DescribeEdgeConfigurationRequest method. req, resp := client.DescribeEdgeConfigurationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/kinesisvideo-2017-09-30/DescribeEdgeConfiguration
func (c *KinesisVideo) DescribeEdgeConfigurationRequest(input *DescribeEdgeConfigurationInput) (req *request.Request, output *DescribeEdgeConfigurationOutput) { op := &request.Operation{ Name: opDescribeEdgeConfiguration, HTTPMethod: "POST", HTTPPath: "/describeEdgeConfiguration", } if input == nil { input = &DescribeEdgeConfigurationInput{} } output = &DescribeEdgeConfigurationOutput{} req = c.newRequest(op, input, output) return }
func (c *KinesisVideo) DeleteEdgeConfigurationRequest(input *DeleteEdgeConfigurationInput) (req *request.Request, output *DeleteEdgeConfigurationOutput) { op := &request.Operation{ Name: opDeleteEdgeConfiguration, HTTPMethod: "POST", HTTPPath: "/deleteEdgeConfiguration", } if input == nil { input = &DeleteEdgeConfigurationInput{} } output = &DeleteEdgeConfigurationOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(restjson.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
0.858726
aws/aws-sdk-go
service/kinesisvideo/api.go
aws/aws-sdk-go
service/kinesisvideo/api.go
Apache-2.0
go
DescribeEdgeConfigurationRequest generates a "aws/request.Request" representing the client's request for the DescribeEdgeConfiguration operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DescribeEdgeConfiguration for more information on using the DescribeEdgeConfiguration API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DescribeEdgeConfigurationRequest method. req, resp := client.DescribeEdgeConfigurationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/kinesisvideo-2017-09-30/DescribeEdgeConfiguration
func (c *KinesisVideo) DescribeEdgeConfigurationRequest(input *DescribeEdgeConfigurationInput) (req *request.Request, output *DescribeEdgeConfigurationOutput) { op := &request.Operation{ Name: opDescribeEdgeConfiguration, HTTPMethod: "POST", HTTPPath: "/describeEdgeConfiguration", } if input == nil { input = &DescribeEdgeConfigurationInput{} } output = &DescribeEdgeConfigurationOutput{} req = c.newRequest(op, input, output) return }
func (c *KinesisVideo) DescribeEdgeConfiguration(input *DescribeEdgeConfigurationInput) (*DescribeEdgeConfigurationOutput, error) { req, out := c.DescribeEdgeConfigurationRequest(input) return out, req.Send() }
0.811512
aws/aws-sdk-go
service/kinesisvideo/api.go
aws/aws-sdk-go
service/kinesisvideo/api.go
Apache-2.0
go
DescribeEdgeConfigurationRequest generates a "aws/request.Request" representing the client's request for the DescribeEdgeConfiguration operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DescribeEdgeConfiguration for more information on using the DescribeEdgeConfiguration API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DescribeEdgeConfigurationRequest method. req, resp := client.DescribeEdgeConfigurationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/kinesisvideo-2017-09-30/DescribeEdgeConfiguration
func (c *KinesisVideo) DescribeEdgeConfigurationRequest(input *DescribeEdgeConfigurationInput) (req *request.Request, output *DescribeEdgeConfigurationOutput) { op := &request.Operation{ Name: opDescribeEdgeConfiguration, HTTPMethod: "POST", HTTPPath: "/describeEdgeConfiguration", } if input == nil { input = &DescribeEdgeConfigurationInput{} } output = &DescribeEdgeConfigurationOutput{} req = c.newRequest(op, input, output) return }
func (c *KinesisVideo) StartEdgeConfigurationUpdateRequest(input *StartEdgeConfigurationUpdateInput) (req *request.Request, output *StartEdgeConfigurationUpdateOutput) { op := &request.Operation{ Name: opStartEdgeConfigurationUpdate, HTTPMethod: "POST", HTTPPath: "/startEdgeConfigurationUpdate", } if input == nil { input = &StartEdgeConfigurationUpdateInput{} } output = &StartEdgeConfigurationUpdateOutput{} req = c.newRequest(op, input, output) return }
0.765702
aws/aws-sdk-go
service/kinesisvideo/api.go
aws/aws-sdk-go
service/kinesisvideo/api.go
Apache-2.0
go
DescribeEdgeConfigurationRequest generates a "aws/request.Request" representing the client's request for the DescribeEdgeConfiguration operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DescribeEdgeConfiguration for more information on using the DescribeEdgeConfiguration API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DescribeEdgeConfigurationRequest method. req, resp := client.DescribeEdgeConfigurationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/kinesisvideo-2017-09-30/DescribeEdgeConfiguration
func (c *KinesisVideo) DescribeEdgeConfigurationRequest(input *DescribeEdgeConfigurationInput) (req *request.Request, output *DescribeEdgeConfigurationOutput) { op := &request.Operation{ Name: opDescribeEdgeConfiguration, HTTPMethod: "POST", HTTPPath: "/describeEdgeConfiguration", } if input == nil { input = &DescribeEdgeConfigurationInput{} } output = &DescribeEdgeConfigurationOutput{} req = c.newRequest(op, input, output) return }
func (c *MQ) DescribeConfigurationRequest(input *DescribeConfigurationInput) (req *request.Request, output *DescribeConfigurationOutput) { op := &request.Operation{ Name: opDescribeConfiguration, HTTPMethod: "GET", HTTPPath: "/v1/configurations/{configuration-id}", } if input == nil { input = &DescribeConfigurationInput{} } output = &DescribeConfigurationOutput{} req = c.newRequest(op, input, output) return }
0.732179
aws/aws-sdk-go
service/kinesisvideo/api.go
aws/aws-sdk-go
service/mq/api.go
Apache-2.0
go
DescribeEdgeConfigurationRequest generates a "aws/request.Request" representing the client's request for the DescribeEdgeConfiguration operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DescribeEdgeConfiguration for more information on using the DescribeEdgeConfiguration API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DescribeEdgeConfigurationRequest method. req, resp := client.DescribeEdgeConfigurationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/kinesisvideo-2017-09-30/DescribeEdgeConfiguration
func (c *KinesisVideo) DescribeEdgeConfigurationRequest(input *DescribeEdgeConfigurationInput) (req *request.Request, output *DescribeEdgeConfigurationOutput) { op := &request.Operation{ Name: opDescribeEdgeConfiguration, HTTPMethod: "POST", HTTPPath: "/describeEdgeConfiguration", } if input == nil { input = &DescribeEdgeConfigurationInput{} } output = &DescribeEdgeConfigurationOutput{} req = c.newRequest(op, input, output) return }
func (c *KinesisVideo) DescribeEdgeConfigurationWithContext(ctx aws.Context, input *DescribeEdgeConfigurationInput, opts ...request.Option) (*DescribeEdgeConfigurationOutput, error) { req, out := c.DescribeEdgeConfigurationRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.728072
aws/aws-sdk-go
service/kinesisvideo/api.go
aws/aws-sdk-go
service/kinesisvideo/api.go
Apache-2.0
go
AddPodToMesh adds a pod to mesh by 1. Getting the netns (and making sure the netns is cached in the ztunnel state of the world snapshot) 2. Adding the pod's IPs to the hostnetns ipsets for node probe checks 3. Creating iptables rules inside the pod's netns 4. Notifying the connected ztunnel via GRPC to create a proxy for the pod You may ask why we pass the pod IPs separately from the pod manifest itself (which contains the pod IPs as a field) - this is because during add specifically, if CNI plugins have not finished executing, K8S may get a pod Add event without any IPs in the object, and the pod will later be updated with IPs. We always need the IPs, but this is fine because this AddPodToMesh can be called from the CNI plugin as well, which always has the firsthand info of the IPs, even before K8S does - so we pass them separately here because we actually may have them before K8S in the Pod object. Importantly, some of the failures that can occur when calling this function are retryable, and some are not. If this function returns a NonRetryableError, the function call should NOT be retried. Any other error indicates the function call can be retried.
func (s *NetServer) AddPodToMesh(ctx context.Context, pod *corev1.Pod, podIPs []netip.Addr, netNs string) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.Info("adding pod to the mesh") // make sure the cache is aware of the pod, even if we don't have the netns yet. s.currentPodSnapshot.Ensure(string(pod.UID)) openNetns, err := s.getOrOpenNetns(pod, netNs) if err != nil { return NewErrNonRetryableAdd(err) } podCfg := getPodLevelTrafficOverrides(pod) log.Debug("calling CreateInpodRules") if err := s.netnsRunner(openNetns, func() error { return s.podIptables.CreateInpodRules(log, podCfg) }); err != nil { // We currently treat any failure to create inpod rules as non-retryable/catastrophic, // and return a NonRetryableError in this case. log.Errorf("failed to update POD inpod: %s/%s %v", pod.Namespace, pod.Name, err) return NewErrNonRetryableAdd(err) } // For *any* other failures after a successful `CreateInpodRules` call, we must return // the error as-is. // // This is so that if it is removed from the mesh, the inpod rules will unconditionally // be removed. // // Additionally, unlike the other errors, it is safe to retry regular errors with another // `AddPodToMesh`, in case a ztunnel connection later becomes available. log.Debug("notifying subscribed node proxies") if err := s.sendPodToZtunnelAndWaitForAck(ctx, pod, openNetns); err != nil { return err } return nil }
func (s *meshDataplane) AddPodToMesh(ctx context.Context, pod *corev1.Pod, podIPs []netip.Addr, netNs string) error { // Ordering is important in this func: // // - Inject rules and add to ztunnel FIRST // - Annotate IF rule injection doesn't fail. // - Add pod IP to ipset IF none of the above has failed, as a last step log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) if err := s.netServer.AddPodToMesh(ctx, pod, podIPs, netNs); err != nil { // iptables injection failed, this is not a "retryable partial add" // this is a nonrecoverable/nonretryable error and we won't even bother to // annotate the pod or retry the event. if errors.Is(err, ErrNonRetryableAdd) { // propagate, bail immediately, don't continue return err } // Any other error is recoverable/retryable and means we just couldn't contact ztunnel. // However, any other error also means iptables injection was successful, so // we must annotate the pod with a partial status (so removal can undo iptables) // regardless of ztunnel's current status. // So annotate indicating that this pod was injected (and thus needs to be either retried // or uninjected on removal) but is not fully captured yet. log.Error("failed to add pod to ztunnel: pod partially added, annotating with pending status") if err := util.AnnotatePartiallyEnrolledPod(s.kubeClient, &pod.ObjectMeta); err != nil { // If we have an error annotating the partial status - that is itself retryable. return err } // Otherwise return the original error return err } // Handle node healthcheck probe rewrites if _, err := s.addPodToHostNSIpset(pod, podIPs); err != nil { log.Errorf("failed to add pod to ipset, pod will fail healthchecks: %v", err) // Adding pod to ipset should always be an upsert, so should not fail // unless we have a kernel incompatibility - thus it should either // never fail, or isn't usefully retryable. // For now tho, err on the side of being loud in the logs, // since retrying in that case isn't _harmful_ and means all pods will fail anyway. return err } // Once we successfully annotate the pod as fully captured, // the informer can no longer retry events, and there's no going back. // This should be the last step in all cases - once we do this, the CP (and the informer) will consider // this pod "ambient" and successfully enrolled. log.Debugf("annotating pod") if err := util.AnnotateEnrolledPod(s.kubeClient, &pod.ObjectMeta); err != nil { // If we have an error annotating the full status - that is retryable. // (maybe K8S is busy, etc - but we need a k8s controlplane ACK). return err } return nil }
0.793343
istio/istio
cni/pkg/nodeagent/net_linux.go
istio/istio
cni/pkg/nodeagent/meshdataplane_linux.go
Apache-2.0
go
AddPodToMesh adds a pod to mesh by 1. Getting the netns (and making sure the netns is cached in the ztunnel state of the world snapshot) 2. Adding the pod's IPs to the hostnetns ipsets for node probe checks 3. Creating iptables rules inside the pod's netns 4. Notifying the connected ztunnel via GRPC to create a proxy for the pod You may ask why we pass the pod IPs separately from the pod manifest itself (which contains the pod IPs as a field) - this is because during add specifically, if CNI plugins have not finished executing, K8S may get a pod Add event without any IPs in the object, and the pod will later be updated with IPs. We always need the IPs, but this is fine because this AddPodToMesh can be called from the CNI plugin as well, which always has the firsthand info of the IPs, even before K8S does - so we pass them separately here because we actually may have them before K8S in the Pod object. Importantly, some of the failures that can occur when calling this function are retryable, and some are not. If this function returns a NonRetryableError, the function call should NOT be retried. Any other error indicates the function call can be retried.
func (s *NetServer) AddPodToMesh(ctx context.Context, pod *corev1.Pod, podIPs []netip.Addr, netNs string) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.Info("adding pod to the mesh") // make sure the cache is aware of the pod, even if we don't have the netns yet. s.currentPodSnapshot.Ensure(string(pod.UID)) openNetns, err := s.getOrOpenNetns(pod, netNs) if err != nil { return NewErrNonRetryableAdd(err) } podCfg := getPodLevelTrafficOverrides(pod) log.Debug("calling CreateInpodRules") if err := s.netnsRunner(openNetns, func() error { return s.podIptables.CreateInpodRules(log, podCfg) }); err != nil { // We currently treat any failure to create inpod rules as non-retryable/catastrophic, // and return a NonRetryableError in this case. log.Errorf("failed to update POD inpod: %s/%s %v", pod.Namespace, pod.Name, err) return NewErrNonRetryableAdd(err) } // For *any* other failures after a successful `CreateInpodRules` call, we must return // the error as-is. // // This is so that if it is removed from the mesh, the inpod rules will unconditionally // be removed. // // Additionally, unlike the other errors, it is safe to retry regular errors with another // `AddPodToMesh`, in case a ztunnel connection later becomes available. log.Debug("notifying subscribed node proxies") if err := s.sendPodToZtunnelAndWaitForAck(ctx, pod, openNetns); err != nil { return err } return nil }
func (s *meshDataplane) addPodToHostNSIpset(pod *corev1.Pod, podIPs []netip.Addr) ([]netip.Addr, error) { // Add the pod UID as an ipset entry comment, so we can (more) easily find and delete // all relevant entries for a pod later. podUID := string(pod.ObjectMeta.UID) ipProto := uint8(unix.IPPROTO_TCP) log := log.WithLabels("ns", pod.Namespace, "name", pod.Name, "podUID", podUID, "ipset", s.hostsideProbeIPSet.Prefix) var ipsetAddrErrs []error var addedIps []netip.Addr err := util.RunAsHost(func() error { // For each pod IP for _, pip := range podIPs { // Add to host ipset log.Debugf("adding probe ip %s to set", pip) if err := s.hostsideProbeIPSet.AddIP(pip, ipProto, podUID, true); err != nil { ipsetAddrErrs = append(ipsetAddrErrs, err) log.Errorf("failed adding ip %s to set, error was %s", pip, err) } else { addedIps = append(addedIps, pip) } } return nil }) if err != nil { ipsetAddrErrs = append(ipsetAddrErrs, err) } return addedIps, errors.Join(ipsetAddrErrs...) }
0.724153
istio/istio
cni/pkg/nodeagent/net_linux.go
istio/istio
cni/pkg/nodeagent/meshdataplane_linux.go
Apache-2.0
go
AddPodToMesh adds a pod to mesh by 1. Getting the netns (and making sure the netns is cached in the ztunnel state of the world snapshot) 2. Adding the pod's IPs to the hostnetns ipsets for node probe checks 3. Creating iptables rules inside the pod's netns 4. Notifying the connected ztunnel via GRPC to create a proxy for the pod You may ask why we pass the pod IPs separately from the pod manifest itself (which contains the pod IPs as a field) - this is because during add specifically, if CNI plugins have not finished executing, K8S may get a pod Add event without any IPs in the object, and the pod will later be updated with IPs. We always need the IPs, but this is fine because this AddPodToMesh can be called from the CNI plugin as well, which always has the firsthand info of the IPs, even before K8S does - so we pass them separately here because we actually may have them before K8S in the Pod object. Importantly, some of the failures that can occur when calling this function are retryable, and some are not. If this function returns a NonRetryableError, the function call should NOT be retried. Any other error indicates the function call can be retried.
func (s *NetServer) AddPodToMesh(ctx context.Context, pod *corev1.Pod, podIPs []netip.Addr, netNs string) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.Info("adding pod to the mesh") // make sure the cache is aware of the pod, even if we don't have the netns yet. s.currentPodSnapshot.Ensure(string(pod.UID)) openNetns, err := s.getOrOpenNetns(pod, netNs) if err != nil { return NewErrNonRetryableAdd(err) } podCfg := getPodLevelTrafficOverrides(pod) log.Debug("calling CreateInpodRules") if err := s.netnsRunner(openNetns, func() error { return s.podIptables.CreateInpodRules(log, podCfg) }); err != nil { // We currently treat any failure to create inpod rules as non-retryable/catastrophic, // and return a NonRetryableError in this case. log.Errorf("failed to update POD inpod: %s/%s %v", pod.Namespace, pod.Name, err) return NewErrNonRetryableAdd(err) } // For *any* other failures after a successful `CreateInpodRules` call, we must return // the error as-is. // // This is so that if it is removed from the mesh, the inpod rules will unconditionally // be removed. // // Additionally, unlike the other errors, it is safe to retry regular errors with another // `AddPodToMesh`, in case a ztunnel connection later becomes available. log.Debug("notifying subscribed node proxies") if err := s.sendPodToZtunnelAndWaitForAck(ctx, pod, openNetns); err != nil { return err } return nil }
func (s *meshDataplane) RemovePodFromMesh(ctx context.Context, pod *corev1.Pod, isDelete bool) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.WithLabels("deleted", isDelete).Info("removing pod from mesh") // Remove the hostside ipset entry first, and unconditionally - if later failures happen, we never // want to leave stale entries (and the pod healthchecks will start to fail, which is a good signal) if err := removePodFromHostNSIpset(pod, &s.hostsideProbeIPSet); err != nil { log.Errorf("failed to remove pod %s from host ipset, error was: %v", pod.Name, err) // Removing pod from ipset should never fail, even if the IP is no longer there // (unless we have a kernel incompatibility). // - so while retrying on ipser remove error is safe from an eventing perspective, // it may not be useful return err } // Specifically, at this time, we do _not_ want to un-annotate the pod if we cannot successfully remove it, // as the pod is probably in a broken state and we don't want to let go of it from the CP perspective while that is true. // So we will return if this fails (for a potential retry). if err := s.netServer.RemovePodFromMesh(ctx, pod, isDelete); err != nil { log.Errorf("failed to remove pod from mesh: %v", err) return err } // This should be the last step in all cases - once we do this, the CP will no longer consider // this pod "ambient" (and the informer will not be able to retry on removal errors), // regardless of the state it is in. log.Debug("removing annotation from pod") if err := util.AnnotateUnenrollPod(s.kubeClient, &pod.ObjectMeta); err != nil { log.Errorf("failed to annotate pod unenrollment: %v", err) // If the pod is already terminating anyway, we don't care if we can't remove the annotation, // so only return a retryable error on annotation failure if it's not terminating. if !isDelete { // If we have an error annotating the partial status and the pod is not terminating // - that is retryable. return err } } return nil }
0.661118
istio/istio
cni/pkg/nodeagent/net_linux.go
istio/istio
cni/pkg/nodeagent/meshdataplane_linux.go
Apache-2.0
go
AddPodToMesh adds a pod to mesh by 1. Getting the netns (and making sure the netns is cached in the ztunnel state of the world snapshot) 2. Adding the pod's IPs to the hostnetns ipsets for node probe checks 3. Creating iptables rules inside the pod's netns 4. Notifying the connected ztunnel via GRPC to create a proxy for the pod You may ask why we pass the pod IPs separately from the pod manifest itself (which contains the pod IPs as a field) - this is because during add specifically, if CNI plugins have not finished executing, K8S may get a pod Add event without any IPs in the object, and the pod will later be updated with IPs. We always need the IPs, but this is fine because this AddPodToMesh can be called from the CNI plugin as well, which always has the firsthand info of the IPs, even before K8S does - so we pass them separately here because we actually may have them before K8S in the Pod object. Importantly, some of the failures that can occur when calling this function are retryable, and some are not. If this function returns a NonRetryableError, the function call should NOT be retried. Any other error indicates the function call can be retried.
func (s *NetServer) AddPodToMesh(ctx context.Context, pod *corev1.Pod, podIPs []netip.Addr, netNs string) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.Info("adding pod to the mesh") // make sure the cache is aware of the pod, even if we don't have the netns yet. s.currentPodSnapshot.Ensure(string(pod.UID)) openNetns, err := s.getOrOpenNetns(pod, netNs) if err != nil { return NewErrNonRetryableAdd(err) } podCfg := getPodLevelTrafficOverrides(pod) log.Debug("calling CreateInpodRules") if err := s.netnsRunner(openNetns, func() error { return s.podIptables.CreateInpodRules(log, podCfg) }); err != nil { // We currently treat any failure to create inpod rules as non-retryable/catastrophic, // and return a NonRetryableError in this case. log.Errorf("failed to update POD inpod: %s/%s %v", pod.Namespace, pod.Name, err) return NewErrNonRetryableAdd(err) } // For *any* other failures after a successful `CreateInpodRules` call, we must return // the error as-is. // // This is so that if it is removed from the mesh, the inpod rules will unconditionally // be removed. // // Additionally, unlike the other errors, it is safe to retry regular errors with another // `AddPodToMesh`, in case a ztunnel connection later becomes available. log.Debug("notifying subscribed node proxies") if err := s.sendPodToZtunnelAndWaitForAck(ctx, pod, openNetns); err != nil { return err } return nil }
func (s *NetServer) RemovePodFromMesh(ctx context.Context, pod *corev1.Pod, isDelete bool) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.WithLabels("delete", isDelete).Debugf("removing pod from the mesh") // Whether pod is already deleted or not, we need to let go of our netns ref. openNetns := s.currentPodSnapshot.Take(string(pod.UID)) if openNetns == nil { log.Debug("failed to find pod netns during removal") } // If the pod is already deleted or terminated, we do not need to clean up the pod network -- only the host side. if !isDelete { if openNetns != nil { // pod is removed from the mesh, but is still running. remove iptables rules log.Debugf("calling DeleteInpodRules") if err := s.netnsRunner(openNetns, func() error { return s.podIptables.DeleteInpodRules(log) }); err != nil { return fmt.Errorf("failed to delete inpod rules: %w", err) } } else { log.Warn("pod netns already gone, not deleting inpod rules") } } log.Debug("removing pod from ztunnel") if err := s.ztunnelServer.PodDeleted(ctx, string(pod.UID)); err != nil { log.Errorf("failed to delete pod from ztunnel: %v", err) return err } return nil }
0.63984
istio/istio
cni/pkg/nodeagent/net_linux.go
istio/istio
cni/pkg/nodeagent/net_linux.go
Apache-2.0
go
AddPodToMesh adds a pod to mesh by 1. Getting the netns (and making sure the netns is cached in the ztunnel state of the world snapshot) 2. Adding the pod's IPs to the hostnetns ipsets for node probe checks 3. Creating iptables rules inside the pod's netns 4. Notifying the connected ztunnel via GRPC to create a proxy for the pod You may ask why we pass the pod IPs separately from the pod manifest itself (which contains the pod IPs as a field) - this is because during add specifically, if CNI plugins have not finished executing, K8S may get a pod Add event without any IPs in the object, and the pod will later be updated with IPs. We always need the IPs, but this is fine because this AddPodToMesh can be called from the CNI plugin as well, which always has the firsthand info of the IPs, even before K8S does - so we pass them separately here because we actually may have them before K8S in the Pod object. Importantly, some of the failures that can occur when calling this function are retryable, and some are not. If this function returns a NonRetryableError, the function call should NOT be retried. Any other error indicates the function call can be retried.
func (s *NetServer) AddPodToMesh(ctx context.Context, pod *corev1.Pod, podIPs []netip.Addr, netNs string) error { log := log.WithLabels("ns", pod.Namespace, "name", pod.Name) log.Info("adding pod to the mesh") // make sure the cache is aware of the pod, even if we don't have the netns yet. s.currentPodSnapshot.Ensure(string(pod.UID)) openNetns, err := s.getOrOpenNetns(pod, netNs) if err != nil { return NewErrNonRetryableAdd(err) } podCfg := getPodLevelTrafficOverrides(pod) log.Debug("calling CreateInpodRules") if err := s.netnsRunner(openNetns, func() error { return s.podIptables.CreateInpodRules(log, podCfg) }); err != nil { // We currently treat any failure to create inpod rules as non-retryable/catastrophic, // and return a NonRetryableError in this case. log.Errorf("failed to update POD inpod: %s/%s %v", pod.Namespace, pod.Name, err) return NewErrNonRetryableAdd(err) } // For *any* other failures after a successful `CreateInpodRules` call, we must return // the error as-is. // // This is so that if it is removed from the mesh, the inpod rules will unconditionally // be removed. // // Additionally, unlike the other errors, it is safe to retry regular errors with another // `AddPodToMesh`, in case a ztunnel connection later becomes available. log.Debug("notifying subscribed node proxies") if err := s.sendPodToZtunnelAndWaitForAck(ctx, pod, openNetns); err != nil { return err } return nil }
func (s *NetServer) reconcileExistingPod(pod *corev1.Pod) error { openNetns, err := s.getNetns(pod) if err != nil { return err } podCfg := getPodLevelTrafficOverrides(pod) if err := s.netnsRunner(openNetns, func() error { return s.podIptables.CreateInpodRules(log, podCfg) }); err != nil { return err } return nil }
0.605026
istio/istio
cni/pkg/nodeagent/net_linux.go
istio/istio
cni/pkg/nodeagent/net_linux.go
Apache-2.0
go
PSHUFD performs "Shuffle Packed Doublewords". Mnemonic : PSHUFD Supported forms : (2 forms) * PSHUFD imm8, xmm, xmm [SSE2] * PSHUFD imm8, m128, xmm [SSE2]
func (self *Program) PSHUFD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFD", 3, Operands { v0, v1, v2 }) // PSHUFD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFD") } return p }
func (self *Program) VPSHUFD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("VPSHUFD", 3, Operands { v0, v1, v2 }) // VPSHUFD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_AVX) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.vex2(1, hcode(v[2]), v[1], 0) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_AVX) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.vex2(1, hcode(v[2]), addr(v[1]), 0) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, ymm, ymm if isImm8(v0) && isYMM(v1) && isYMM(v2) { self.require(ISA_AVX2) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.vex2(5, hcode(v[2]), v[1], 0) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, m256, ymm if isImm8(v0) && isM256(v1) && isYMM(v2) { self.require(ISA_AVX2) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.vex2(5, hcode(v[2]), addr(v[1]), 0) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, m512/m32bcst, zmm{k}{z} if isImm8(v0) && isM512M32bcst(v1) && isZMMkz(v2) { self.require(ISA_AVX512F) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.evex(0b01, 0x05, 0b10, ehcode(v[2]), addr(v[1]), 0, kcode(v[2]), zcode(v[2]), bcode(v[1])) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 64) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, zmm, zmm{k}{z} if isImm8(v0) && isZMM(v1) && isZMMkz(v2) { self.require(ISA_AVX512F) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x62) m.emit(0xf1 ^ ((hcode(v[2]) << 7) | (ehcode(v[1]) << 5) | (ecode(v[2]) << 4))) m.emit(0x7d) m.emit((zcode(v[2]) << 7) | kcode(v[2]) | 0x48) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, m128/m32bcst, xmm{k}{z} if isImm8(v0) && isM128M32bcst(v1) && isXMMkz(v2) { self.require(ISA_AVX512VL | ISA_AVX512F) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.evex(0b01, 0x05, 0b00, ehcode(v[2]), addr(v[1]), 0, kcode(v[2]), zcode(v[2]), bcode(v[1])) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 16) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, m256/m32bcst, ymm{k}{z} if isImm8(v0) && isM256M32bcst(v1) && isYMMkz(v2) { self.require(ISA_AVX512VL | ISA_AVX512F) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.evex(0b01, 0x05, 0b01, ehcode(v[2]), addr(v[1]), 0, kcode(v[2]), zcode(v[2]), bcode(v[1])) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 32) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, xmm, xmm{k}{z} if isImm8(v0) && isEVEXXMM(v1) && isXMMkz(v2) { self.require(ISA_AVX512VL | ISA_AVX512F) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x62) m.emit(0xf1 ^ ((hcode(v[2]) << 7) | (ehcode(v[1]) << 5) | (ecode(v[2]) << 4))) m.emit(0x7d) m.emit((zcode(v[2]) << 7) | kcode(v[2]) | 0x08) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // VPSHUFD imm8, ymm, ymm{k}{z} if isImm8(v0) && isEVEXYMM(v1) && isYMMkz(v2) { self.require(ISA_AVX512VL | ISA_AVX512F) p.domain = DomainAVX p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x62) m.emit(0xf1 ^ ((hcode(v[2]) << 7) | (ehcode(v[1]) << 5) | (ecode(v[2]) << 4))) m.emit(0x7d) m.emit((zcode(v[2]) << 7) | kcode(v[2]) | 0x28) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for VPSHUFD") } return p }
0.927842
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
PSHUFD performs "Shuffle Packed Doublewords". Mnemonic : PSHUFD Supported forms : (2 forms) * PSHUFD imm8, xmm, xmm [SSE2] * PSHUFD imm8, m128, xmm [SSE2]
func (self *Program) PSHUFD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFD", 3, Operands { v0, v1, v2 }) // PSHUFD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFD") } return p }
func (self *Program) PSHUFHW(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFHW", 3, Operands { v0, v1, v2 }) // PSHUFHW imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0xf3) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFHW imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0xf3) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFHW") } return p }
0.903761
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
PSHUFD performs "Shuffle Packed Doublewords". Mnemonic : PSHUFD Supported forms : (2 forms) * PSHUFD imm8, xmm, xmm [SSE2] * PSHUFD imm8, m128, xmm [SSE2]
func (self *Program) PSHUFD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFD", 3, Operands { v0, v1, v2 }) // PSHUFD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFD") } return p }
func (self *Program) PSHUFLW(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFLW", 3, Operands { v0, v1, v2 }) // PSHUFLW imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0xf2) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFLW imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0xf2) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFLW") } return p }
0.898351
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
PSHUFD performs "Shuffle Packed Doublewords". Mnemonic : PSHUFD Supported forms : (2 forms) * PSHUFD imm8, xmm, xmm [SSE2] * PSHUFD imm8, m128, xmm [SSE2]
func (self *Program) PSHUFD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFD", 3, Operands { v0, v1, v2 }) // PSHUFD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFD") } return p }
func (self *Program) PSHUFW(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFW", 3, Operands { v0, v1, v2 }) // PSHUFW imm8, mm, mm if isImm8(v0) && isMM(v1) && isMM(v2) { self.require(ISA_MMX_PLUS) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFW imm8, m64, mm if isImm8(v0) && isM64(v1) && isMM(v2) { self.require(ISA_MMX_PLUS) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFW") } return p }
0.89174
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
PSHUFD performs "Shuffle Packed Doublewords". Mnemonic : PSHUFD Supported forms : (2 forms) * PSHUFD imm8, xmm, xmm [SSE2] * PSHUFD imm8, m128, xmm [SSE2]
func (self *Program) PSHUFD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("PSHUFD", 3, Operands { v0, v1, v2 }) // PSHUFD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0x70) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // PSHUFD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0x70) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for PSHUFD") } return p }
func (self *Program) SHUFPD(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("SHUFPD", 3, Operands { v0, v1, v2 }) // SHUFPD imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0xc6) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // SHUFPD imm8, m128, xmm if isImm8(v0) && isM128(v1) && isXMM(v2) { self.require(ISA_SSE2) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x66) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0xc6) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for SHUFPD") } return p }
0.840968
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
UpdateViewContentWithContext is the same as UpdateViewContent with the addition of the ability to pass a context and additional request options. See UpdateViewContent for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *Connect) UpdateViewContentWithContext(ctx aws.Context, input *UpdateViewContentInput, opts ...request.Option) (*UpdateViewContentOutput, error) { req, out := c.UpdateViewContentRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *ResourceExplorer2) UpdateViewWithContext(ctx aws.Context, input *UpdateViewInput, opts ...request.Option) (*UpdateViewOutput, error) { req, out := c.UpdateViewRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.864967
aws/aws-sdk-go
service/connect/api.go
aws/aws-sdk-go
service/resourceexplorer2/api.go
Apache-2.0
go
UpdateViewContentWithContext is the same as UpdateViewContent with the addition of the ability to pass a context and additional request options. See UpdateViewContent for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *Connect) UpdateViewContentWithContext(ctx aws.Context, input *UpdateViewContentInput, opts ...request.Option) (*UpdateViewContentOutput, error) { req, out := c.UpdateViewContentRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *ConnectWisdomService) UpdateContentWithContext(ctx aws.Context, input *UpdateContentInput, opts ...request.Option) (*UpdateContentOutput, error) { req, out := c.UpdateContentRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.858477
aws/aws-sdk-go
service/connect/api.go
aws/aws-sdk-go
service/connectwisdomservice/api.go
Apache-2.0
go
UpdateViewContentWithContext is the same as UpdateViewContent with the addition of the ability to pass a context and additional request options. See UpdateViewContent for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *Connect) UpdateViewContentWithContext(ctx aws.Context, input *UpdateViewContentInput, opts ...request.Option) (*UpdateViewContentOutput, error) { req, out := c.UpdateViewContentRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *Connect) UpdateViewMetadataWithContext(ctx aws.Context, input *UpdateViewMetadataInput, opts ...request.Option) (*UpdateViewMetadataOutput, error) { req, out := c.UpdateViewMetadataRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.761998
aws/aws-sdk-go
service/connect/api.go
aws/aws-sdk-go
service/connect/api.go
Apache-2.0
go
UpdateViewContentWithContext is the same as UpdateViewContent with the addition of the ability to pass a context and additional request options. See UpdateViewContent for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *Connect) UpdateViewContentWithContext(ctx aws.Context, input *UpdateViewContentInput, opts ...request.Option) (*UpdateViewContentOutput, error) { req, out := c.UpdateViewContentRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *Connect) UpdateViewContent(input *UpdateViewContentInput) (*UpdateViewContentOutput, error) { req, out := c.UpdateViewContentRequest(input) return out, req.Send() }
0.740208
aws/aws-sdk-go
service/connect/api.go
aws/aws-sdk-go
service/connect/api.go
Apache-2.0
go
UpdateViewContentWithContext is the same as UpdateViewContent with the addition of the ability to pass a context and additional request options. See UpdateViewContent for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *Connect) UpdateViewContentWithContext(ctx aws.Context, input *UpdateViewContentInput, opts ...request.Option) (*UpdateViewContentOutput, error) { req, out := c.UpdateViewContentRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *Connect) CreateViewVersionWithContext(ctx aws.Context, input *CreateViewVersionInput, opts ...request.Option) (*CreateViewVersionOutput, error) { req, out := c.CreateViewVersionRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.709233
aws/aws-sdk-go
service/connect/api.go
aws/aws-sdk-go
service/connect/api.go
Apache-2.0
go
Write accepts an event to be dispatched to all sinks. This method will never fail and should never block (hopefully!). The caller cedes the memory to the broadcaster and should not modify it after calling write.
func (b *Broadcaster) Write(event Event) error { select { case b.events <- event: case <-b.closed: return ErrSinkClosed } return nil }
func (b *Broadcaster) Write(events ...Event) error { select { case b.events <- events: case <-b.closed: return ErrSinkClosed } return nil }
0.886745
docker/cli
vendor/github.com/docker/go-events/broadcast.go
genuinetools/binctr
vendor/github.com/docker/distribution/notifications/sinks.go
MIT
go
Write accepts an event to be dispatched to all sinks. This method will never fail and should never block (hopefully!). The caller cedes the memory to the broadcaster and should not modify it after calling write.
func (b *Broadcaster) Write(event Event) error { select { case b.events <- event: case <-b.closed: return ErrSinkClosed } return nil }
func (c *Client) write(event *Event) { c.mu.RLock() defer c.mu.RUnlock() if c.conn == nil { // Drop the event if disconnected. c.debugLogEvent(event, true) return } t := time.NewTimer(30 * time.Second) defer t.Stop() select { case c.tx <- event: case <-t.C: c.debugLogEvent(event, true) } }
0.725615
docker/cli
vendor/github.com/docker/go-events/broadcast.go
42wim/matterbridge
vendor/github.com/lrstanley/girc/conn.go
Apache-2.0
go
Write accepts an event to be dispatched to all sinks. This method will never fail and should never block (hopefully!). The caller cedes the memory to the broadcaster and should not modify it after calling write.
func (b *Broadcaster) Write(event Event) error { select { case b.events <- event: case <-b.closed: return ErrSinkClosed } return nil }
func (w *StreamWriter) Send(ctx aws.Context, event Marshaler) error { if err := w.Err(); err != nil { return err } resultCh := make(chan error) wrapped := eventWriteAsyncReport{ Event: event, Result: resultCh, } select { case w.stream <- wrapped: case <-ctx.Done(): return ctx.Err() case <-w.done: return fmt.Errorf("stream closed, unable to send event") } select { case err := <-resultCh: return err case <-ctx.Done(): return ctx.Err() case <-w.done: return fmt.Errorf("stream closed, unable to send event") } }
0.720631
docker/cli
vendor/github.com/docker/go-events/broadcast.go
armory/spinnaker-operator
vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/stream_writer.go
Apache-2.0
go
Write accepts an event to be dispatched to all sinks. This method will never fail and should never block (hopefully!). The caller cedes the memory to the broadcaster and should not modify it after calling write.
func (b *Broadcaster) Write(event Event) error { select { case b.events <- event: case <-b.closed: return ErrSinkClosed } return nil }
func (provider *Provider) writeEventRaw( descriptor *eventDescriptor, activityID guid.GUID, relatedActivityID guid.GUID, metadataBlobs [][]byte, dataBlobs [][]byte) error { dataDescriptorCount := uint32(1 + len(metadataBlobs) + len(dataBlobs)) dataDescriptors := make([]eventDataDescriptor, 0, dataDescriptorCount) dataDescriptors = append(dataDescriptors, newEventDataDescriptor(eventDataDescriptorTypeProviderMetadata, provider.metadata)) for _, blob := range metadataBlobs { dataDescriptors = append(dataDescriptors, newEventDataDescriptor(eventDataDescriptorTypeEventMetadata, blob)) } for _, blob := range dataBlobs { dataDescriptors = append(dataDescriptors, newEventDataDescriptor(eventDataDescriptorTypeUserData, blob)) } return eventWriteTransfer(provider.handle, descriptor, (*windows.GUID)(&activityID), (*windows.GUID)(&relatedActivityID), dataDescriptorCount, &dataDescriptors[0]) }
0.684885
docker/cli
vendor/github.com/docker/go-events/broadcast.go
microsoft/go-winio
pkg/etw/provider.go
MIT
go
Write accepts an event to be dispatched to all sinks. This method will never fail and should never block (hopefully!). The caller cedes the memory to the broadcaster and should not modify it after calling write.
func (b *Broadcaster) Write(event Event) error { select { case b.events <- event: case <-b.closed: return ErrSinkClosed } return nil }
func (es *StartCallAnalyticsStreamTranscriptionEventStream) Send(ctx aws.Context, event AudioStreamEvent) error { return es.Writer.Send(ctx, event) }
0.612221
docker/cli
vendor/github.com/docker/go-events/broadcast.go
aws/aws-sdk-go
service/transcribestreamingservice/api.go
Apache-2.0
go
readLog queries the db for the saved pb.Update record identified by the specified indexEntry parameter. For each encountered pb.Update record, h will be invoked with the encountered pb.Update value passed to it.
func (d *db) readLog(ie indexEntry, h func(u pb.Update, offset int64) bool) (err error) { fn := makeFilename(d.opts.FS, d.dirname, fileTypeLog, ie.fileNum) f, err := d.opts.FS.Open(fn) if err != nil { return err } defer func() { err = firstError(err, f.Close()) }() rr := newReader(f, ie.fileNum) if ie.pos > 0 { if err := rr.seekRecord(ie.pos); err != nil { return errors.WithStack(err) } } var buf bytes.Buffer var r io.Reader for { offset := rr.offset() r, err = rr.next() if err != nil { if err == io.EOF { return nil } return errors.WithStack(err) } if _, err = io.Copy(&buf, r); err != nil { if err == io.EOF { return nil } return errors.Wrap(err, "error when reading WAL") } var update pb.Update pb.MustUnmarshal(&update, buf.Bytes()) if !h(update, offset) { break } buf.Reset() } return nil }
func (d *db) removeEntries(shardID uint64, replicaID uint64, index uint64) error { return d.remove(shardID, replicaID, index) }
0.582737
lni/dragonboat
internal/tan/db.go
lni/dragonboat
internal/tan/compaction.go
Apache-2.0
go
readLog queries the db for the saved pb.Update record identified by the specified indexEntry parameter. For each encountered pb.Update record, h will be invoked with the encountered pb.Update value passed to it.
func (d *db) readLog(ie indexEntry, h func(u pb.Update, offset int64) bool) (err error) { fn := makeFilename(d.opts.FS, d.dirname, fileTypeLog, ie.fileNum) f, err := d.opts.FS.Open(fn) if err != nil { return err } defer func() { err = firstError(err, f.Close()) }() rr := newReader(f, ie.fileNum) if ie.pos > 0 { if err := rr.seekRecord(ie.pos); err != nil { return errors.WithStack(err) } } var buf bytes.Buffer var r io.Reader for { offset := rr.offset() r, err = rr.next() if err != nil { if err == io.EOF { return nil } return errors.WithStack(err) } if _, err = io.Copy(&buf, r); err != nil { if err == io.EOF { return nil } return errors.Wrap(err, "error when reading WAL") } var update pb.Update pb.MustUnmarshal(&update, buf.Bytes()) if !h(update, offset) { break } buf.Reset() } return nil }
func (l *wal) seekEntry(raftIndex uint64) (entry, error) { if raftIndex == 0 { return emptyEntry, nil } fidx, off := l.slotGe(raftIndex) if off == -1 { // The entry is not in the log because it was already processed and compacted. return emptyEntry, raft.ErrCompacted } else if off >= maxNumEntries { // The log has not advanced past the given raftIndex. return emptyEntry, raft.ErrUnavailable } ef := l.getEntryFile(fidx) ent := ef.getEntry(off) if ent.Index() == 0 { // The log has not advanced past the given raftIndex. return emptyEntry, raft.ErrUnavailable } if ent.Index() != raftIndex { return emptyEntry, errNotFound } return ent, nil }
0.556112
lni/dragonboat
internal/tan/db.go
hypermodeinc/dgraph
raftwal/wal.go
Apache-2.0
go
readLog queries the db for the saved pb.Update record identified by the specified indexEntry parameter. For each encountered pb.Update record, h will be invoked with the encountered pb.Update value passed to it.
func (d *db) readLog(ie indexEntry, h func(u pb.Update, offset int64) bool) (err error) { fn := makeFilename(d.opts.FS, d.dirname, fileTypeLog, ie.fileNum) f, err := d.opts.FS.Open(fn) if err != nil { return err } defer func() { err = firstError(err, f.Close()) }() rr := newReader(f, ie.fileNum) if ie.pos > 0 { if err := rr.seekRecord(ie.pos); err != nil { return errors.WithStack(err) } } var buf bytes.Buffer var r io.Reader for { offset := rr.offset() r, err = rr.next() if err != nil { if err == io.EOF { return nil } return errors.WithStack(err) } if _, err = io.Copy(&buf, r); err != nil { if err == io.EOF { return nil } return errors.Wrap(err, "error when reading WAL") } var update pb.Update pb.MustUnmarshal(&update, buf.Bytes()) if !h(update, offset) { break } buf.Reset() } return nil }
func (vs *versionSet) logAndApply( ve *versionEdit, dir vfs.File, ) error { if !vs.writing { panic("MANIFEST not locked for writing") } defer vs.logUnlock() // This is the next manifest filenum, but if the current file is too big we // will write this ve to the next file which means what ve encodes is the // current filenum and not the next one. // // TODO(sbhola): figure out why this is correct and update comment. ve.nextFileNum = vs.nextFileNum currentVersion := vs.currentVersion() var newVersion *version // Generate a new manifest if we don't currently have one, or the current one // is too large. var newManifestFileNum fileNum if vs.manifest == nil || vs.manifest.size() >= vs.maxManifestFileSize { newManifestFileNum = vs.getNextFileNum() } // Grab certain values before releasing vs.mu, in case createManifest() needs // to be called. nextFileNum := vs.nextFileNum var zombies map[fileNum]uint64 if err := func() error { var bve bulkVersionEdit if err := bve.accumulate(ve); err != nil { return err } var err error newVersion, zombies, err = bve.apply(currentVersion) if err != nil { return err } if newManifestFileNum != 0 { if err := vs.createManifest(vs.dirname, newManifestFileNum, nextFileNum); err != nil { return err } } w, err := vs.manifest.next() if err != nil { return err } // NB: Any error from this point on is considered fatal as we don't now if // the MANIFEST write occurred or not. Trying to determine that is // fraught. Instead we rely on the standard recovery mechanism run when a // database is open. In particular, that mechanism generates a new MANIFEST // and ensures it is synced. if err := ve.encode(w); err != nil { return err } if err := vs.manifest.flush(); err != nil { return err } if err := vs.manifestFile.Sync(); err != nil { return err } if newManifestFileNum != 0 { if err := setCurrentFile(vs.dirname, vs.fs, newManifestFileNum); err != nil { return err } if err := dir.Sync(); err != nil { return err } } return nil }(); err != nil { return err } // Update the zombie tables set first, as installation of the new version // will unref the previous version which could result in addObsoleteLocked // being called. for fileNum, size := range zombies { vs.zombieTables[fileNum] = size } // Install the new version. vs.append(newVersion) if newManifestFileNum != 0 { if vs.manifestFileNum != 0 { vs.obsoleteManifests = append(vs.obsoleteManifests, vs.manifestFileNum) } vs.manifestFileNum = newManifestFileNum } return nil }
0.550195
lni/dragonboat
internal/tan/db.go
lni/dragonboat
internal/tan/version_set.go
Apache-2.0
go
readLog queries the db for the saved pb.Update record identified by the specified indexEntry parameter. For each encountered pb.Update record, h will be invoked with the encountered pb.Update value passed to it.
func (d *db) readLog(ie indexEntry, h func(u pb.Update, offset int64) bool) (err error) { fn := makeFilename(d.opts.FS, d.dirname, fileTypeLog, ie.fileNum) f, err := d.opts.FS.Open(fn) if err != nil { return err } defer func() { err = firstError(err, f.Close()) }() rr := newReader(f, ie.fileNum) if ie.pos > 0 { if err := rr.seekRecord(ie.pos); err != nil { return errors.WithStack(err) } } var buf bytes.Buffer var r io.Reader for { offset := rr.offset() r, err = rr.next() if err != nil { if err == io.EOF { return nil } return errors.WithStack(err) } if _, err = io.Copy(&buf, r); err != nil { if err == io.EOF { return nil } return errors.Wrap(err, "error when reading WAL") } var update pb.Update pb.MustUnmarshal(&update, buf.Bytes()) if !h(update, offset) { break } buf.Reset() } return nil }
func (e *indexEntry) merge(n indexEntry) (indexEntry, indexEntry, bool) { if e.end+1 == n.start && e.pos+e.length == n.pos && e.fileNum == n.fileNum && e.indexBlock() == n.indexBlock() { result := *e result.end = n.end result.length = e.length + n.length return result, indexEntry{}, true } return *e, n, false }
0.522486
lni/dragonboat
internal/tan/db.go
lni/dragonboat
internal/tan/index.go
Apache-2.0
go
readLog queries the db for the saved pb.Update record identified by the specified indexEntry parameter. For each encountered pb.Update record, h will be invoked with the encountered pb.Update value passed to it.
func (d *db) readLog(ie indexEntry, h func(u pb.Update, offset int64) bool) (err error) { fn := makeFilename(d.opts.FS, d.dirname, fileTypeLog, ie.fileNum) f, err := d.opts.FS.Open(fn) if err != nil { return err } defer func() { err = firstError(err, f.Close()) }() rr := newReader(f, ie.fileNum) if ie.pos > 0 { if err := rr.seekRecord(ie.pos); err != nil { return errors.WithStack(err) } } var buf bytes.Buffer var r io.Reader for { offset := rr.offset() r, err = rr.next() if err != nil { if err == io.EOF { return nil } return errors.WithStack(err) } if _, err = io.Copy(&buf, r); err != nil { if err == io.EOF { return nil } return errors.Wrap(err, "error when reading WAL") } var update pb.Update pb.MustUnmarshal(&update, buf.Bytes()) if !h(update, offset) { break } buf.Reset() } return nil }
func (l *logContext) infer() error { // We force-insert a checkpoint whenever we hit the known fixed interval. if l.nextEntryIndex%searchCheckpointFrequency == 0 { l.need.Add(FlagSearchCheckpoint) } if l.need.Any(FlagSearchCheckpoint) { l.appendEntry(newSearchCheckpoint(l.blockNum, l.logsSince, l.timestamp)) l.need.Add(FlagCanonicalHash) // always follow with a canonical hash l.need.Remove(FlagSearchCheckpoint) return nil } if l.need.Any(FlagCanonicalHash) { l.appendEntry(newCanonicalHash(l.blockHash)) l.need.Remove(FlagCanonicalHash) return nil } if l.need.Any(FlagPadding) { l.appendEntry(paddingEntry{}) l.need.Remove(FlagPadding) return nil } if l.need.Any(FlagPadding2) { l.appendEntry(paddingEntry{}) l.need.Remove(FlagPadding2) return nil } if l.need.Any(FlagInitiatingEvent) { // If we are running out of space for log-event data, // write some checkpoints as padding, to pass the checkpoint. if l.execMsg != nil { // takes 3 total. Need to avoid the checkpoint. switch l.nextEntryIndex % searchCheckpointFrequency { case searchCheckpointFrequency - 1: l.need.Add(FlagPadding) return nil case searchCheckpointFrequency - 2: l.need.Add(FlagPadding | FlagPadding2) return nil } } evt := newInitiatingEvent(l.logHash, l.execMsg != nil) l.appendEntry(evt) l.need.Remove(FlagInitiatingEvent) if l.execMsg == nil { l.logsSince += 1 } return nil } if l.need.Any(FlagExecutingLink) { link, err := newExecutingLink(*l.execMsg) if err != nil { return fmt.Errorf("failed to create executing link: %w", err) } l.appendEntry(link) l.need.Remove(FlagExecutingLink) return nil } if l.need.Any(FlagExecutingCheck) { l.appendEntry(newExecutingCheck(l.execMsg.Hash)) l.need.Remove(FlagExecutingCheck) l.logsSince += 1 return nil } return io.EOF }
0.514802
lni/dragonboat
internal/tan/db.go
ethereum-optimism/optimism
op-supervisor/supervisor/backend/db/logs/state.go
MIT
go
DeleteChannel API operation for AWS Elemental MediaPackage v2. Delete a channel to stop AWS Elemental MediaPackage from receiving further content. You must delete the channel's origin endpoints before you can delete the channel. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Elemental MediaPackage v2's API operation DeleteChannel for usage and error information. Returned Error Types: - ThrottlingException The request throughput limit was exceeded. - ConflictException Updating or deleting this resource can cause an inconsistent state. - InternalServerException Indicates that an error from the service occurred while trying to process a request. - AccessDeniedException You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. - ValidationException The input failed to meet the constraints specified by the AWS service. See also, https://docs.aws.amazon.com/goto/WebAPI/mediapackagev2-2022-12-25/DeleteChannel
func (c *MediaPackageV2) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
func (c *MediaPackage) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
0.952385
aws/aws-sdk-go
service/mediapackagev2/api.go
aws/aws-sdk-go
service/mediapackage/api.go
Apache-2.0
go
DeleteChannel API operation for AWS Elemental MediaPackage v2. Delete a channel to stop AWS Elemental MediaPackage from receiving further content. You must delete the channel's origin endpoints before you can delete the channel. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Elemental MediaPackage v2's API operation DeleteChannel for usage and error information. Returned Error Types: - ThrottlingException The request throughput limit was exceeded. - ConflictException Updating or deleting this resource can cause an inconsistent state. - InternalServerException Indicates that an error from the service occurred while trying to process a request. - AccessDeniedException You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. - ValidationException The input failed to meet the constraints specified by the AWS service. See also, https://docs.aws.amazon.com/goto/WebAPI/mediapackagev2-2022-12-25/DeleteChannel
func (c *MediaPackageV2) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
func (c *MediaLive) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
0.906757
aws/aws-sdk-go
service/mediapackagev2/api.go
aws/aws-sdk-go
service/medialive/api.go
Apache-2.0
go
DeleteChannel API operation for AWS Elemental MediaPackage v2. Delete a channel to stop AWS Elemental MediaPackage from receiving further content. You must delete the channel's origin endpoints before you can delete the channel. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Elemental MediaPackage v2's API operation DeleteChannel for usage and error information. Returned Error Types: - ThrottlingException The request throughput limit was exceeded. - ConflictException Updating or deleting this resource can cause an inconsistent state. - InternalServerException Indicates that an error from the service occurred while trying to process a request. - AccessDeniedException You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. - ValidationException The input failed to meet the constraints specified by the AWS service. See also, https://docs.aws.amazon.com/goto/WebAPI/mediapackagev2-2022-12-25/DeleteChannel
func (c *MediaPackageV2) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
func (c *IVS) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
0.895785
aws/aws-sdk-go
service/mediapackagev2/api.go
aws/aws-sdk-go
service/ivs/api.go
Apache-2.0
go
DeleteChannel API operation for AWS Elemental MediaPackage v2. Delete a channel to stop AWS Elemental MediaPackage from receiving further content. You must delete the channel's origin endpoints before you can delete the channel. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Elemental MediaPackage v2's API operation DeleteChannel for usage and error information. Returned Error Types: - ThrottlingException The request throughput limit was exceeded. - ConflictException Updating or deleting this resource can cause an inconsistent state. - InternalServerException Indicates that an error from the service occurred while trying to process a request. - AccessDeniedException You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. - ValidationException The input failed to meet the constraints specified by the AWS service. See also, https://docs.aws.amazon.com/goto/WebAPI/mediapackagev2-2022-12-25/DeleteChannel
func (c *MediaPackageV2) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
func (c *IoTAnalytics) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
0.873445
aws/aws-sdk-go
service/mediapackagev2/api.go
aws/aws-sdk-go
service/iotanalytics/api.go
Apache-2.0
go
DeleteChannel API operation for AWS Elemental MediaPackage v2. Delete a channel to stop AWS Elemental MediaPackage from receiving further content. You must delete the channel's origin endpoints before you can delete the channel. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Elemental MediaPackage v2's API operation DeleteChannel for usage and error information. Returned Error Types: - ThrottlingException The request throughput limit was exceeded. - ConflictException Updating or deleting this resource can cause an inconsistent state. - InternalServerException Indicates that an error from the service occurred while trying to process a request. - AccessDeniedException You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. - ValidationException The input failed to meet the constraints specified by the AWS service. See also, https://docs.aws.amazon.com/goto/WebAPI/mediapackagev2-2022-12-25/DeleteChannel
func (c *MediaPackageV2) DeleteChannel(input *DeleteChannelInput) (*DeleteChannelOutput, error) { req, out := c.DeleteChannelRequest(input) return out, req.Send() }
func (c *MediaPackageV2) DeleteChannelPolicy(input *DeleteChannelPolicyInput) (*DeleteChannelPolicyOutput, error) { req, out := c.DeleteChannelPolicyRequest(input) return out, req.Send() }
0.870825
aws/aws-sdk-go
service/mediapackagev2/api.go
aws/aws-sdk-go
service/mediapackagev2/api.go
Apache-2.0
go
NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. Always prefer using an informer factory to get a shared informer instead of getting an independent one. This reduces memory footprint and number of connections to the server.
func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) }, }, &corev1.PodTemplate{}, resyncPeriod, indexers, ) }
func NewPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredPodTemplateInformer(client, namespace, resyncPeriod, indexers, nil) }
0.96838
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/podtemplate.go
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/podtemplate.go
Apache-2.0
go
NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. Always prefer using an informer factory to get a shared informer instead of getting an independent one. This reduces memory footprint and number of connections to the server.
func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) }, }, &corev1.PodTemplate{}, resyncPeriod, indexers, ) }
func NewFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().Pods(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().Pods(namespace).Watch(context.TODO(), options) }, }, &corev1.Pod{}, resyncPeriod, indexers, ) }
0.864768
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/podtemplate.go
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/pod.go
Apache-2.0
go
NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. Always prefer using an informer factory to get a shared informer instead of getting an independent one. This reduces memory footprint and number of connections to the server.
func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) }, }, &corev1.PodTemplate{}, resyncPeriod, indexers, ) }
func NewPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredPodInformer(client, namespace, resyncPeriod, indexers, nil) }
0.837791
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/podtemplate.go
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/pod.go
Apache-2.0
go
NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. Always prefer using an informer factory to get a shared informer instead of getting an independent one. This reduces memory footprint and number of connections to the server.
func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) }, }, &corev1.PodTemplate{}, resyncPeriod, indexers, ) }
func NewFilteredPodSchedulingContextInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha2().PodSchedulingContexts(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha2().PodSchedulingContexts(namespace).Watch(context.TODO(), options) }, }, &resourcev1alpha2.PodSchedulingContext{}, resyncPeriod, indexers, ) }
0.816437
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/podtemplate.go
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/resource/v1alpha2/podschedulingcontext.go
Apache-2.0
go
NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. Always prefer using an informer factory to get a shared informer instead of getting an independent one. This reduces memory footprint and number of connections to the server.
func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) }, }, &corev1.PodTemplate{}, resyncPeriod, indexers, ) }
func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha2().ResourceClaimTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha2().ResourceClaimTemplates(namespace).Watch(context.TODO(), options) }, }, &resourcev1alpha2.ResourceClaimTemplate{}, resyncPeriod, indexers, ) }
0.806848
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/core/v1/podtemplate.go
k8snetworkplumbingwg/multus-cni
vendor/k8s.io/client-go/informers/resource/v1alpha2/resourceclaimtemplate.go
Apache-2.0
go
filterImages returns a slice of images which are passing all specified filters. tree must be provided if compileImageFilters indicated it is necessary.
func (r *Runtime) filterImages(ctx context.Context, images []*Image, filters compiledFilters, tree *layerTree) ([]*Image, error) { result := []*Image{} for i := range images { match, err := images[i].applyFilters(ctx, filters, tree) if err != nil { return nil, err } if match { result = append(result, images[i]) } } return result, nil }
func (i *ImageService) Images(imageFilters filters.Args, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error) { var ( allImages map[image.ID]*image.Image err error danglingOnly = false ) if err := imageFilters.Validate(acceptedImageFilterTags); err != nil { return nil, err } if imageFilters.Contains("dangling") { if imageFilters.ExactMatch("dangling", "true") { danglingOnly = true } else if !imageFilters.ExactMatch("dangling", "false") { return nil, invalidFilter{"dangling", imageFilters.Get("dangling")} } } if danglingOnly { allImages = i.imageStore.Heads() } else { allImages = i.imageStore.Map() } var beforeFilter, sinceFilter *image.Image err = imageFilters.WalkValues("before", func(value string) error { beforeFilter, err = i.GetImage(value) return err }) if err != nil { return nil, err } err = imageFilters.WalkValues("since", func(value string) error { sinceFilter, err = i.GetImage(value) return err }) if err != nil { return nil, err } images := []*types.ImageSummary{} var imagesMap map[*image.Image]*types.ImageSummary var layerRefs map[layer.ChainID]int var allLayers map[layer.ChainID]layer.Layer var allContainers []*container.Container for id, img := range allImages { if beforeFilter != nil { if img.Created.Equal(beforeFilter.Created) || img.Created.After(beforeFilter.Created) { continue } } if sinceFilter != nil { if img.Created.Equal(sinceFilter.Created) || img.Created.Before(sinceFilter.Created) { continue } } if imageFilters.Contains("label") { // Very old image that do not have image.Config (or even labels) if img.Config == nil { continue } // We are now sure image.Config is not nil if !imageFilters.MatchKVList("label", img.Config.Labels) { continue } } // Skip any images with an unsupported operating system to avoid a potential // panic when indexing through the layerstore. Don't error as we want to list // the other images. This should never happen, but here as a safety precaution. if !system.IsOSSupported(img.OperatingSystem()) { continue } layerID := img.RootFS.ChainID() var size int64 if layerID != "" { l, err := i.layerStores[img.OperatingSystem()].Get(layerID) if err != nil { // The layer may have been deleted between the call to `Map()` or // `Heads()` and the call to `Get()`, so we just ignore this error if err == layer.ErrLayerDoesNotExist { continue } return nil, err } size, err = l.Size() layer.ReleaseAndLog(i.layerStores[img.OperatingSystem()], l) if err != nil { return nil, err } } newImage := newImage(img, size) for _, ref := range i.referenceStore.References(id.Digest()) { if imageFilters.Contains("reference") { var found bool var matchErr error for _, pattern := range imageFilters.Get("reference") { found, matchErr = reference.FamiliarMatch(pattern, ref) if matchErr != nil { return nil, matchErr } } if !found { continue } } if _, ok := ref.(reference.Canonical); ok { newImage.RepoDigests = append(newImage.RepoDigests, reference.FamiliarString(ref)) } if _, ok := ref.(reference.NamedTagged); ok { newImage.RepoTags = append(newImage.RepoTags, reference.FamiliarString(ref)) } } if newImage.RepoDigests == nil && newImage.RepoTags == nil { if all || len(i.imageStore.Children(id)) == 0 { if imageFilters.Contains("dangling") && !danglingOnly { //dangling=false case, so dangling image is not needed continue } if imageFilters.Contains("reference") { // skip images with no references if filtering by reference continue } newImage.RepoDigests = []string{"<none>@<none>"} newImage.RepoTags = []string{"<none>:<none>"} } else { continue } } else if danglingOnly && len(newImage.RepoTags) > 0 { continue } if withExtraAttrs { // lazily init variables if imagesMap == nil { allContainers = i.containers.List() allLayers = i.layerStores[img.OperatingSystem()].Map() imagesMap = make(map[*image.Image]*types.ImageSummary) layerRefs = make(map[layer.ChainID]int) } // Get container count newImage.Containers = 0 for _, c := range allContainers { if c.ImageID == id { newImage.Containers++ } } // count layer references rootFS := *img.RootFS rootFS.DiffIDs = nil for _, id := range img.RootFS.DiffIDs { rootFS.Append(id) chid := rootFS.ChainID() layerRefs[chid]++ if _, ok := allLayers[chid]; !ok { return nil, fmt.Errorf("layer %v was not found (corruption?)", chid) } } imagesMap[img] = newImage } images = append(images, newImage) } if withExtraAttrs { // Get Shared sizes for img, newImage := range imagesMap { rootFS := *img.RootFS rootFS.DiffIDs = nil newImage.SharedSize = 0 for _, id := range img.RootFS.DiffIDs { rootFS.Append(id) chid := rootFS.ChainID() diffSize, err := allLayers[chid].DiffSize() if err != nil { return nil, err } if layerRefs[chid] > 1 { newImage.SharedSize += diffSize } } } } sort.Sort(sort.Reverse(byCreated(images))) return images, nil }
0.737455
containers/podman-tui
vendor/github.com/containers/common/libimage/filters.go
genuinetools/binctr
vendor/github.com/docker/docker/daemon/images/images.go
MIT
go
filterImages returns a slice of images which are passing all specified filters. tree must be provided if compileImageFilters indicated it is necessary.
func (r *Runtime) filterImages(ctx context.Context, images []*Image, filters compiledFilters, tree *layerTree) ([]*Image, error) { result := []*Image{} for i := range images { match, err := images[i].applyFilters(ctx, filters, tree) if err != nil { return nil, err } if match { result = append(result, images[i]) } } return result, nil }
func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOptions) (compiledFilters, bool, error) { logrus.Tracef("Parsing image filters %s", options.Filters) if len(options.Filters) == 0 { return nil, false, nil } filterInvalidValue := `invalid image filter %q: must be in the format "filter=value or filter!=value"` var wantedReferenceMatches, unwantedReferenceMatches []string filters := compiledFilters{} needsLayerTree := false duplicate := map[string]string{} for _, f := range options.Filters { var key, value string var filter filterFunc negate := false split := strings.SplitN(f, "!=", 2) if len(split) == 2 { negate = true } else { split = strings.SplitN(f, "=", 2) if len(split) != 2 { return nil, false, fmt.Errorf(filterInvalidValue, f) } } key = split[0] value = split[1] switch key { case "after", "since": img, err := r.time(key, value) if err != nil { return nil, false, err } key = "since" filter = filterAfter(img.Created()) case "before": img, err := r.time(key, value) if err != nil { return nil, false, err } filter = filterBefore(img.Created()) case "containers": if err := r.containers(duplicate, key, value, options.IsExternalContainerFunc); err != nil { return nil, false, err } filter = filterContainers(value, options.IsExternalContainerFunc) case "dangling": dangling, err := r.bool(duplicate, key, value) if err != nil { return nil, false, err } needsLayerTree = true filter = filterDangling(ctx, dangling) case "id": filter = filterID(value) case "digest": f, err := filterDigest(value) if err != nil { return nil, false, err } filter = f case "intermediate": intermediate, err := r.bool(duplicate, key, value) if err != nil { return nil, false, err } needsLayerTree = true filter = filterIntermediate(ctx, intermediate) case "label": filter = filterLabel(ctx, value) case "readonly": readOnly, err := r.bool(duplicate, key, value) if err != nil { return nil, false, err } filter = filterReadOnly(readOnly) case "manifest": manifest, err := r.bool(duplicate, key, value) if err != nil { return nil, false, err } filter = filterManifest(ctx, manifest) case "reference": if negate { unwantedReferenceMatches = append(unwantedReferenceMatches, value) } else { wantedReferenceMatches = append(wantedReferenceMatches, value) } continue case "until": until, err := r.until(value) if err != nil { return nil, false, err } filter = filterBefore(until) default: return nil, false, fmt.Errorf(filterInvalidValue, key) } if negate { filter = negateFilter(filter) } filters[key] = append(filters[key], filter) } // reference filters is a special case as it does an OR for positive matches // and an AND logic for negative matches filter := filterReferences(r, wantedReferenceMatches, unwantedReferenceMatches) filters["reference"] = append(filters["reference"], filter) return filters, needsLayerTree, nil }
0.653979
containers/podman-tui
vendor/github.com/containers/common/libimage/filters.go
containers/podman-tui
vendor/github.com/containers/common/libimage/filters.go
Apache-2.0
go
filterImages returns a slice of images which are passing all specified filters. tree must be provided if compileImageFilters indicated it is necessary.
func (r *Runtime) filterImages(ctx context.Context, images []*Image, filters compiledFilters, tree *layerTree) ([]*Image, error) { result := []*Image{} for i := range images { match, err := images[i].applyFilters(ctx, filters, tree) if err != nil { return nil, err } if match { result = append(result, images[i]) } } return result, nil }
func (c *Client) PruneImages(opts PruneImagesOptions) (*PruneImagesResults, error) { path := "/images/prune?" + queryString(opts) resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) if err != nil { return nil, err } defer resp.Body.Close() var results PruneImagesResults if err := json.NewDecoder(resp.Body).Decode(&results); err != nil { return nil, err } return &results, nil }
0.597589
containers/podman-tui
vendor/github.com/containers/common/libimage/filters.go
fsouza/go-dockerclient
image.go
BSD-2-Clause
go
filterImages returns a slice of images which are passing all specified filters. tree must be provided if compileImageFilters indicated it is necessary.
func (r *Runtime) filterImages(ctx context.Context, images []*Image, filters compiledFilters, tree *layerTree) ([]*Image, error) { result := []*Image{} for i := range images { match, err := images[i].applyFilters(ctx, filters, tree) if err != nil { return nil, err } if match { result = append(result, images[i]) } } return result, nil }
func (i *Image) getChildren(ctx context.Context, all bool, tree *layerTree) ([]*Image, error) { if tree == nil { t, err := i.runtime.newFreshLayerTree() if err != nil { return nil, err } tree = t } return tree.children(ctx, i, all) }
0.592542
containers/podman-tui
vendor/github.com/containers/common/libimage/filters.go
containers/podman-tui
vendor/github.com/containers/common/libimage/image.go
Apache-2.0
go
filterImages returns a slice of images which are passing all specified filters. tree must be provided if compileImageFilters indicated it is necessary.
func (r *Runtime) filterImages(ctx context.Context, images []*Image, filters compiledFilters, tree *layerTree) ([]*Image, error) { result := []*Image{} for i := range images { match, err := images[i].applyFilters(ctx, filters, tree) if err != nil { return nil, err } if match { result = append(result, images[i]) } } return result, nil }
func FindImages(index v1.ImageIndex, matcher match.Matcher) ([]v1.Image, error) { matches := []v1.Image{} manifests, err := FindManifests(index, matcher) if err != nil { return nil, err } for _, desc := range manifests { // if it is not an image, ignore it if !desc.MediaType.IsImage() { continue } img, err := index.Image(desc.Digest) if err != nil { return nil, err } matches = append(matches, img) } return matches, nil }
0.58949
containers/podman-tui
vendor/github.com/containers/common/libimage/filters.go
tektoncd/cli
vendor/github.com/google/go-containerregistry/pkg/v1/partial/index.go
Apache-2.0
go
GetComponent API operation for AWS Systems Manager for SAP. Gets the component of an application registered with AWS Systems Manager for SAP. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Systems Manager for SAP's API operation GetComponent for usage and error information. Returned Error Types: - UnauthorizedException The request is not authorized. - ValidationException The input fails to satisfy the constraints specified by an AWS service. - InternalServerException An internal error has occurred. See also, https://docs.aws.amazon.com/goto/WebAPI/ssm-sap-2018-05-10/GetComponent
func (c *SsmSap) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
func (c *Proton) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
0.858509
aws/aws-sdk-go
service/ssmsap/api.go
aws/aws-sdk-go
service/proton/api.go
Apache-2.0
go
GetComponent API operation for AWS Systems Manager for SAP. Gets the component of an application registered with AWS Systems Manager for SAP. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Systems Manager for SAP's API operation GetComponent for usage and error information. Returned Error Types: - UnauthorizedException The request is not authorized. - ValidationException The input fails to satisfy the constraints specified by an AWS service. - InternalServerException An internal error has occurred. See also, https://docs.aws.amazon.com/goto/WebAPI/ssm-sap-2018-05-10/GetComponent
func (c *SsmSap) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
func (c *AmplifyUIBuilder) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
0.827782
aws/aws-sdk-go
service/ssmsap/api.go
aws/aws-sdk-go
service/amplifyuibuilder/api.go
Apache-2.0
go
GetComponent API operation for AWS Systems Manager for SAP. Gets the component of an application registered with AWS Systems Manager for SAP. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Systems Manager for SAP's API operation GetComponent for usage and error information. Returned Error Types: - UnauthorizedException The request is not authorized. - ValidationException The input fails to satisfy the constraints specified by an AWS service. - InternalServerException An internal error has occurred. See also, https://docs.aws.amazon.com/goto/WebAPI/ssm-sap-2018-05-10/GetComponent
func (c *SsmSap) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
func (c *Imagebuilder) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
0.766816
aws/aws-sdk-go
service/ssmsap/api.go
aws/aws-sdk-go
service/imagebuilder/api.go
Apache-2.0
go
GetComponent API operation for AWS Systems Manager for SAP. Gets the component of an application registered with AWS Systems Manager for SAP. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Systems Manager for SAP's API operation GetComponent for usage and error information. Returned Error Types: - UnauthorizedException The request is not authorized. - ValidationException The input fails to satisfy the constraints specified by an AWS service. - InternalServerException An internal error has occurred. See also, https://docs.aws.amazon.com/goto/WebAPI/ssm-sap-2018-05-10/GetComponent
func (c *SsmSap) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
func (c *GreengrassV2) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
0.756947
aws/aws-sdk-go
service/ssmsap/api.go
aws/aws-sdk-go
service/greengrassv2/api.go
Apache-2.0
go
GetComponent API operation for AWS Systems Manager for SAP. Gets the component of an application registered with AWS Systems Manager for SAP. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for AWS Systems Manager for SAP's API operation GetComponent for usage and error information. Returned Error Types: - UnauthorizedException The request is not authorized. - ValidationException The input fails to satisfy the constraints specified by an AWS service. - InternalServerException An internal error has occurred. See also, https://docs.aws.amazon.com/goto/WebAPI/ssm-sap-2018-05-10/GetComponent
func (c *SsmSap) GetComponent(input *GetComponentInput) (*GetComponentOutput, error) { req, out := c.GetComponentRequest(input) return out, req.Send() }
func (c *SsmSap) GetApplication(input *GetApplicationInput) (*GetApplicationOutput, error) { req, out := c.GetApplicationRequest(input) return out, req.Send() }
0.748943
aws/aws-sdk-go
service/ssmsap/api.go
aws/aws-sdk-go
service/ssmsap/api.go
Apache-2.0
go
UpdateArtifactWithContext is the same as UpdateArtifact with the addition of the ability to pass a context and additional request options. See UpdateArtifact for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *SageMaker) UpdateArtifactWithContext(ctx aws.Context, input *UpdateArtifactInput, opts ...request.Option) (*UpdateArtifactOutput, error) { req, out := c.UpdateArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *SageMaker) DeleteArtifactWithContext(ctx aws.Context, input *DeleteArtifactInput, opts ...request.Option) (*DeleteArtifactOutput, error) { req, out := c.DeleteArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.866192
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
UpdateArtifactWithContext is the same as UpdateArtifact with the addition of the ability to pass a context and additional request options. See UpdateArtifact for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *SageMaker) UpdateArtifactWithContext(ctx aws.Context, input *UpdateArtifactInput, opts ...request.Option) (*UpdateArtifactOutput, error) { req, out := c.UpdateArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *SageMaker) CreateArtifactWithContext(ctx aws.Context, input *CreateArtifactInput, opts ...request.Option) (*CreateArtifactOutput, error) { req, out := c.CreateArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.849043
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
UpdateArtifactWithContext is the same as UpdateArtifact with the addition of the ability to pass a context and additional request options. See UpdateArtifact for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *SageMaker) UpdateArtifactWithContext(ctx aws.Context, input *UpdateArtifactInput, opts ...request.Option) (*UpdateArtifactOutput, error) { req, out := c.UpdateArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *SageMaker) DescribeArtifactWithContext(ctx aws.Context, input *DescribeArtifactInput, opts ...request.Option) (*DescribeArtifactOutput, error) { req, out := c.DescribeArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.842828
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
UpdateArtifactWithContext is the same as UpdateArtifact with the addition of the ability to pass a context and additional request options. See UpdateArtifact for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *SageMaker) UpdateArtifactWithContext(ctx aws.Context, input *UpdateArtifactInput, opts ...request.Option) (*UpdateArtifactOutput, error) { req, out := c.UpdateArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *MigrationHub) AssociateCreatedArtifactWithContext(ctx aws.Context, input *AssociateCreatedArtifactInput, opts ...request.Option) (*AssociateCreatedArtifactOutput, error) { req, out := c.AssociateCreatedArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.811767
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/migrationhub/api.go
Apache-2.0
go
UpdateArtifactWithContext is the same as UpdateArtifact with the addition of the ability to pass a context and additional request options. See UpdateArtifact for details on how to use this API operation. The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
func (c *SageMaker) UpdateArtifactWithContext(ctx aws.Context, input *UpdateArtifactInput, opts ...request.Option) (*UpdateArtifactOutput, error) { req, out := c.UpdateArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
func (c *GreengrassV2) GetComponentVersionArtifactWithContext(ctx aws.Context, input *GetComponentVersionArtifactInput, opts ...request.Option) (*GetComponentVersionArtifactOutput, error) { req, out := c.GetComponentVersionArtifactRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.777321
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/greengrassv2/api.go
Apache-2.0
go
PlainMessage returns the message string with placeholders replaced * User and group placeholders will be replaced with the name of the user or group respectively. * File placeholders will be replaced with the name of the file.
func (m *TalkRoomMessageData) PlainMessage() string { tr := m.Message for key, value := range m.MessageParameters { tr = strings.ReplaceAll(tr, "{"+key+"}", value.Name) } return tr }
func Format(m proto.Message) string { return MarshalOptions{Multiline: true}.Format(m) }
0.541208
42wim/matterbridge
vendor/gomod.garykim.dev/nc-talk/ocs/message.go
docker/cli
vendor/google.golang.org/protobuf/encoding/protojson/encode.go
Apache-2.0
go
PlainMessage returns the message string with placeholders replaced * User and group placeholders will be replaced with the name of the user or group respectively. * File placeholders will be replaced with the name of the file.
func (m *TalkRoomMessageData) PlainMessage() string { tr := m.Message for key, value := range m.MessageParameters { tr = strings.ReplaceAll(tr, "{"+key+"}", value.Name) } return tr }
func (o MarshalOptions) Format(m proto.Message) string { if m == nil || !m.ProtoReflect().IsValid() { return "<nil>" // invalid syntax, but okay since this is for debugging } o.allowInvalidUTF8 = true o.AllowPartial = true o.EmitUnknown = true b, _ := o.Marshal(m) return string(b) }
0.535169
42wim/matterbridge
vendor/gomod.garykim.dev/nc-talk/ocs/message.go
appscode/osm
vendor/google.golang.org/protobuf/encoding/prototext/encode.go
Apache-2.0
go
PlainMessage returns the message string with placeholders replaced * User and group placeholders will be replaced with the name of the user or group respectively. * File placeholders will be replaced with the name of the file.
func (m *TalkRoomMessageData) PlainMessage() string { tr := m.Message for key, value := range m.MessageParameters { tr = strings.ReplaceAll(tr, "{"+key+"}", value.Name) } return tr }
func (o MarshalOptions) Format(m proto.Message) string { if m == nil || !m.ProtoReflect().IsValid() { return "<nil>" // invalid syntax, but okay since this is for debugging } o.AllowPartial = true b, _ := o.Marshal(m) return string(b) }
0.510101
42wim/matterbridge
vendor/gomod.garykim.dev/nc-talk/ocs/message.go
docker/cli
vendor/google.golang.org/protobuf/encoding/protojson/encode.go
Apache-2.0
go
PlainMessage returns the message string with placeholders replaced * User and group placeholders will be replaced with the name of the user or group respectively. * File placeholders will be replaced with the name of the file.
func (m *TalkRoomMessageData) PlainMessage() string { tr := m.Message for key, value := range m.MessageParameters { tr = strings.ReplaceAll(tr, "{"+key+"}", value.Name) } return tr }
func String(name string) Message { return catmsg.String(name) }
0.509387
42wim/matterbridge
vendor/gomod.garykim.dev/nc-talk/ocs/message.go
Mirantis/cri-dockerd
vendor/golang.org/x/text/message/catalog/catalog.go
Apache-2.0
go
PlainMessage returns the message string with placeholders replaced * User and group placeholders will be replaced with the name of the user or group respectively. * File placeholders will be replaced with the name of the file.
func (m *TalkRoomMessageData) PlainMessage() string { tr := m.Message for key, value := range m.MessageParameters { tr = strings.ReplaceAll(tr, "{"+key+"}", value.Name) } return tr }
func (r *Response) FormattedMessage(format string, verbose bool) (string, error) { statusData := r.getMap(verbose) if format == "json" { data, err := json.MarshalIndent(statusData, "", " ") if err != nil { return "", err } return string(data), nil } statusString := fmt.Sprintf(`%s %s{{if .statuses}} %s API %s Dashboard %s Stripe.js %s Checkout.js{{end}} As of: %s`, emojifiedStatus(r.LargeStatus), ansi.Bold(r.Message), emojifiedStatus(r.Statuses.API), emojifiedStatus(r.Statuses.Dashboard), emojifiedStatus(r.Statuses.Stripejs), emojifiedStatus(r.Statuses.Checkoutjs), ansi.Italic(r.Time), ) tmpl, err := template.New("status").Parse(statusString) if err != nil { return "", err } var output bytes.Buffer err = tmpl.Execute(&output, statusData) if err != nil { return "", nil } return output.String(), nil }
0.471593
42wim/matterbridge
vendor/gomod.garykim.dev/nc-talk/ocs/message.go
stripe/stripe-cli
pkg/status/status.go
Apache-2.0
go
DeleteUserProfileRequest generates a "aws/request.Request" representing the client's request for the DeleteUserProfile operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DeleteUserProfile for more information on using the DeleteUserProfile API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DeleteUserProfileRequest method. req, resp := client.DeleteUserProfileRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/DeleteUserProfile
func (c *SageMaker) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
func (c *OpsWorks) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
0.958175
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/opsworks/api.go
Apache-2.0
go
DeleteUserProfileRequest generates a "aws/request.Request" representing the client's request for the DeleteUserProfile operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DeleteUserProfile for more information on using the DeleteUserProfile API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DeleteUserProfileRequest method. req, resp := client.DeleteUserProfileRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/DeleteUserProfile
func (c *SageMaker) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
func (c *CodeStar) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) return }
0.956142
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/codestar/api.go
Apache-2.0
go
DeleteUserProfileRequest generates a "aws/request.Request" representing the client's request for the DeleteUserProfile operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DeleteUserProfile for more information on using the DeleteUserProfile API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DeleteUserProfileRequest method. req, resp := client.DeleteUserProfileRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/DeleteUserProfile
func (c *SageMaker) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
func (c *SageMaker) UpdateUserProfileRequest(input *UpdateUserProfileInput) (req *request.Request, output *UpdateUserProfileOutput) { op := &request.Operation{ Name: opUpdateUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &UpdateUserProfileInput{} } output = &UpdateUserProfileOutput{} req = c.newRequest(op, input, output) return }
0.857451
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
DeleteUserProfileRequest generates a "aws/request.Request" representing the client's request for the DeleteUserProfile operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DeleteUserProfile for more information on using the DeleteUserProfile API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DeleteUserProfileRequest method. req, resp := client.DeleteUserProfileRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/DeleteUserProfile
func (c *SageMaker) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
func (c *SageMaker) CreateUserProfileRequest(input *CreateUserProfileInput) (req *request.Request, output *CreateUserProfileOutput) { op := &request.Operation{ Name: opCreateUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &CreateUserProfileInput{} } output = &CreateUserProfileOutput{} req = c.newRequest(op, input, output) return }
0.850259
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
DeleteUserProfileRequest generates a "aws/request.Request" representing the client's request for the DeleteUserProfile operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See DeleteUserProfile for more information on using the DeleteUserProfile API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the DeleteUserProfileRequest method. req, resp := client.DeleteUserProfileRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/DeleteUserProfile
func (c *SageMaker) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req *request.Request, output *DeleteUserProfileOutput) { op := &request.Operation{ Name: opDeleteUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DeleteUserProfileInput{} } output = &DeleteUserProfileOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return }
func (c *SageMaker) DescribeUserProfileRequest(input *DescribeUserProfileInput) (req *request.Request, output *DescribeUserProfileOutput) { op := &request.Operation{ Name: opDescribeUserProfile, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &DescribeUserProfileInput{} } output = &DescribeUserProfileOutput{} req = c.newRequest(op, input, output) return }
0.830078
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
GetMilestoneRequest generates a "aws/request.Request" representing the client's request for the GetMilestone operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See GetMilestone for more information on using the GetMilestone API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the GetMilestoneRequest method. req, resp := client.GetMilestoneRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/wellarchitected-2020-03-31/GetMilestone
func (c *WellArchitected) GetMilestoneRequest(input *GetMilestoneInput) (req *request.Request, output *GetMilestoneOutput) { op := &request.Operation{ Name: opGetMilestone, HTTPMethod: "GET", HTTPPath: "/workloads/{WorkloadId}/milestones/{MilestoneNumber}", } if input == nil { input = &GetMilestoneInput{} } output = &GetMilestoneOutput{} req = c.newRequest(op, input, output) return }
func (c *WellArchitected) CreateMilestoneRequest(input *CreateMilestoneInput) (req *request.Request, output *CreateMilestoneOutput) { op := &request.Operation{ Name: opCreateMilestone, HTTPMethod: "POST", HTTPPath: "/workloads/{WorkloadId}/milestones", } if input == nil { input = &CreateMilestoneInput{} } output = &CreateMilestoneOutput{} req = c.newRequest(op, input, output) return }
0.824041
aws/aws-sdk-go
service/wellarchitected/api.go
aws/aws-sdk-go
service/wellarchitected/api.go
Apache-2.0
go
GetMilestoneRequest generates a "aws/request.Request" representing the client's request for the GetMilestone operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See GetMilestone for more information on using the GetMilestone API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the GetMilestoneRequest method. req, resp := client.GetMilestoneRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/wellarchitected-2020-03-31/GetMilestone
func (c *WellArchitected) GetMilestoneRequest(input *GetMilestoneInput) (req *request.Request, output *GetMilestoneOutput) { op := &request.Operation{ Name: opGetMilestone, HTTPMethod: "GET", HTTPPath: "/workloads/{WorkloadId}/milestones/{MilestoneNumber}", } if input == nil { input = &GetMilestoneInput{} } output = &GetMilestoneOutput{} req = c.newRequest(op, input, output) return }
func (c *WellArchitected) GetMilestoneWithContext(ctx aws.Context, input *GetMilestoneInput, opts ...request.Option) (*GetMilestoneOutput, error) { req, out := c.GetMilestoneRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
0.790923
aws/aws-sdk-go
service/wellarchitected/api.go
aws/aws-sdk-go
service/wellarchitected/api.go
Apache-2.0
go
GetMilestoneRequest generates a "aws/request.Request" representing the client's request for the GetMilestone operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See GetMilestone for more information on using the GetMilestone API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the GetMilestoneRequest method. req, resp := client.GetMilestoneRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/wellarchitected-2020-03-31/GetMilestone
func (c *WellArchitected) GetMilestoneRequest(input *GetMilestoneInput) (req *request.Request, output *GetMilestoneOutput) { op := &request.Operation{ Name: opGetMilestone, HTTPMethod: "GET", HTTPPath: "/workloads/{WorkloadId}/milestones/{MilestoneNumber}", } if input == nil { input = &GetMilestoneInput{} } output = &GetMilestoneOutput{} req = c.newRequest(op, input, output) return }
func (c *WellArchitected) GetMilestone(input *GetMilestoneInput) (*GetMilestoneOutput, error) { req, out := c.GetMilestoneRequest(input) return out, req.Send() }
0.762408
aws/aws-sdk-go
service/wellarchitected/api.go
aws/aws-sdk-go
service/wellarchitected/api.go
Apache-2.0
go
GetMilestoneRequest generates a "aws/request.Request" representing the client's request for the GetMilestone operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See GetMilestone for more information on using the GetMilestone API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the GetMilestoneRequest method. req, resp := client.GetMilestoneRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/wellarchitected-2020-03-31/GetMilestone
func (c *WellArchitected) GetMilestoneRequest(input *GetMilestoneInput) (req *request.Request, output *GetMilestoneOutput) { op := &request.Operation{ Name: opGetMilestone, HTTPMethod: "GET", HTTPPath: "/workloads/{WorkloadId}/milestones/{MilestoneNumber}", } if input == nil { input = &GetMilestoneInput{} } output = &GetMilestoneOutput{} req = c.newRequest(op, input, output) return }
func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } milestone := new(Milestone) resp, err := s.client.Do(ctx, req, milestone) if err != nil { return nil, resp, err } return milestone, resp, nil }
0.749432
aws/aws-sdk-go
service/wellarchitected/api.go
tektoncd/cli
vendor/github.com/google/go-github/v55/github/issues_milestones.go
Apache-2.0
go
GetMilestoneRequest generates a "aws/request.Request" representing the client's request for the GetMilestone operation. The "output" return value will be populated with the request's response once the request completes successfully. Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error. See GetMilestone for more information on using the GetMilestone API call, and error handling. This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic. // Example sending a request using the GetMilestoneRequest method. req, resp := client.GetMilestoneRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) } See also, https://docs.aws.amazon.com/goto/WebAPI/wellarchitected-2020-03-31/GetMilestone
func (c *WellArchitected) GetMilestoneRequest(input *GetMilestoneInput) (req *request.Request, output *GetMilestoneOutput) { op := &request.Operation{ Name: opGetMilestone, HTTPMethod: "GET", HTTPPath: "/workloads/{WorkloadId}/milestones/{MilestoneNumber}", } if input == nil { input = &GetMilestoneInput{} } output = &GetMilestoneOutput{} req = c.newRequest(op, input, output) return }
func (c *WellArchitected) ListMilestonesRequest(input *ListMilestonesInput) (req *request.Request, output *ListMilestonesOutput) { op := &request.Operation{ Name: opListMilestones, HTTPMethod: "POST", HTTPPath: "/workloads/{WorkloadId}/milestonesSummaries", Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", TruncationToken: "", }, } if input == nil { input = &ListMilestonesInput{} } output = &ListMilestonesOutput{} req = c.newRequest(op, input, output) return }
0.720877
aws/aws-sdk-go
service/wellarchitected/api.go
aws/aws-sdk-go
service/wellarchitected/api.go
Apache-2.0
go
UpdateDeviceFleet API operation for Amazon SageMaker Service. Updates a fleet of devices. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for Amazon SageMaker Service's API operation UpdateDeviceFleet for usage and error information. Returned Error Types: - ResourceInUse Resource being accessed is in use. See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/UpdateDeviceFleet
func (c *SageMaker) UpdateDeviceFleet(input *UpdateDeviceFleetInput) (*UpdateDeviceFleetOutput, error) { req, out := c.UpdateDeviceFleetRequest(input) return out, req.Send() }
func (c *SageMaker) DeleteDeviceFleet(input *DeleteDeviceFleetInput) (*DeleteDeviceFleetOutput, error) { req, out := c.DeleteDeviceFleetRequest(input) return out, req.Send() }
0.890444
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
UpdateDeviceFleet API operation for Amazon SageMaker Service. Updates a fleet of devices. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for Amazon SageMaker Service's API operation UpdateDeviceFleet for usage and error information. Returned Error Types: - ResourceInUse Resource being accessed is in use. See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/UpdateDeviceFleet
func (c *SageMaker) UpdateDeviceFleet(input *UpdateDeviceFleetInput) (*UpdateDeviceFleetOutput, error) { req, out := c.UpdateDeviceFleetRequest(input) return out, req.Send() }
func (c *AppStream) UpdateFleet(input *UpdateFleetInput) (*UpdateFleetOutput, error) { req, out := c.UpdateFleetRequest(input) return out, req.Send() }
0.865039
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/appstream/api.go
Apache-2.0
go
UpdateDeviceFleet API operation for Amazon SageMaker Service. Updates a fleet of devices. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for Amazon SageMaker Service's API operation UpdateDeviceFleet for usage and error information. Returned Error Types: - ResourceInUse Resource being accessed is in use. See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/UpdateDeviceFleet
func (c *SageMaker) UpdateDeviceFleet(input *UpdateDeviceFleetInput) (*UpdateDeviceFleetOutput, error) { req, out := c.UpdateDeviceFleetRequest(input) return out, req.Send() }
func (c *SageMaker) DescribeDeviceFleet(input *DescribeDeviceFleetInput) (*DescribeDeviceFleetOutput, error) { req, out := c.DescribeDeviceFleetRequest(input) return out, req.Send() }
0.856514
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/sagemaker/api.go
Apache-2.0
go
UpdateDeviceFleet API operation for Amazon SageMaker Service. Updates a fleet of devices. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for Amazon SageMaker Service's API operation UpdateDeviceFleet for usage and error information. Returned Error Types: - ResourceInUse Resource being accessed is in use. See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/UpdateDeviceFleet
func (c *SageMaker) UpdateDeviceFleet(input *UpdateDeviceFleetInput) (*UpdateDeviceFleetOutput, error) { req, out := c.UpdateDeviceFleetRequest(input) return out, req.Send() }
func (c *IoTFleetWise) UpdateFleet(input *UpdateFleetInput) (*UpdateFleetOutput, error) { req, out := c.UpdateFleetRequest(input) return out, req.Send() }
0.855855
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/iotfleetwise/api.go
Apache-2.0
go
UpdateDeviceFleet API operation for Amazon SageMaker Service. Updates a fleet of devices. Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error. See the AWS API reference guide for Amazon SageMaker Service's API operation UpdateDeviceFleet for usage and error information. Returned Error Types: - ResourceInUse Resource being accessed is in use. See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/UpdateDeviceFleet
func (c *SageMaker) UpdateDeviceFleet(input *UpdateDeviceFleetInput) (*UpdateDeviceFleetOutput, error) { req, out := c.UpdateDeviceFleetRequest(input) return out, req.Send() }
func (c *CodeBuild) UpdateFleet(input *UpdateFleetInput) (*UpdateFleetOutput, error) { req, out := c.UpdateFleetRequest(input) return out, req.Send() }
0.85206
aws/aws-sdk-go
service/sagemaker/api.go
aws/aws-sdk-go
service/codebuild/api.go
Apache-2.0
go
CMPB performs "Compare Two Operands". Mnemonic : CMP Supported forms : (6 forms) * CMPB imm8, al * CMPB imm8, r8 * CMPB r8, r8 * CMPB m8, r8 * CMPB imm8, m8 * CMPB r8, m8
func (self *Program) CMPB(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPB", 2, Operands { v0, v1 }) // CMPB imm8, al if isImm8(v0) && v1 == AL { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x3c) m.imm1(toImmAny(v[0])) }) } // CMPB imm8, r8 if isImm8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], isReg8REX(v[1])) m.emit(0x80) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPB r8, r8 if isReg8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x38) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), v[0], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x3a) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPB m8, r8 if isM8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), addr(v[0]), isReg8REX(v[1])) m.emit(0x3a) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPB imm8, m8 if isImm8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x80) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPB r8, m8 if isReg8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), isReg8REX(v[0])) m.emit(0x38) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPB") } return p }
func (self *Program) CMPL(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPL", 2, Operands { v0, v1 }) // CMPL imm32, eax if isImm32(v0) && v1 == EAX { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x3d) m.imm4(toImmAny(v[0])) }) } // CMPL imm8, r32 if isImm8Ext(v0, 4) && isReg32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], false) m.emit(0x83) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPL imm32, r32 if isImm32(v0) && isReg32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], false) m.emit(0x81) m.emit(0xf8 | lcode(v[1])) m.imm4(toImmAny(v[0])) }) } // CMPL r32, r32 if isReg32(v0) && isReg32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], false) m.emit(0x39) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), v[0], false) m.emit(0x3b) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPL m32, r32 if isM32(v0) && isReg32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), addr(v[0]), false) m.emit(0x3b) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPL imm8, m32 if isImm8Ext(v0, 4) && isM32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x83) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPL imm32, m32 if isImm32(v0) && isM32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x81) m.mrsd(7, addr(v[1]), 1) m.imm4(toImmAny(v[0])) }) } // CMPL r32, m32 if isReg32(v0) && isM32(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), false) m.emit(0x39) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPL") } return p }
0.9396
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
CMPB performs "Compare Two Operands". Mnemonic : CMP Supported forms : (6 forms) * CMPB imm8, al * CMPB imm8, r8 * CMPB r8, r8 * CMPB m8, r8 * CMPB imm8, m8 * CMPB r8, m8
func (self *Program) CMPB(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPB", 2, Operands { v0, v1 }) // CMPB imm8, al if isImm8(v0) && v1 == AL { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x3c) m.imm1(toImmAny(v[0])) }) } // CMPB imm8, r8 if isImm8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], isReg8REX(v[1])) m.emit(0x80) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPB r8, r8 if isReg8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x38) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), v[0], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x3a) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPB m8, r8 if isM8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), addr(v[0]), isReg8REX(v[1])) m.emit(0x3a) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPB imm8, m8 if isImm8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x80) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPB r8, m8 if isReg8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), isReg8REX(v[0])) m.emit(0x38) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPB") } return p }
func (self *Program) CMPQ(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPQ", 2, Operands { v0, v1 }) // CMPQ imm32, rax if isImm32(v0) && v1 == RAX { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x48) m.emit(0x3d) m.imm4(toImmAny(v[0])) }) } // CMPQ imm8, r64 if isImm8Ext(v0, 8) && isReg64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x48 | hcode(v[1])) m.emit(0x83) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPQ imm32, r64 if isImm32Ext(v0, 8) && isReg64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x48 | hcode(v[1])) m.emit(0x81) m.emit(0xf8 | lcode(v[1])) m.imm4(toImmAny(v[0])) }) } // CMPQ r64, r64 if isReg64(v0) && isReg64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x48 | hcode(v[0]) << 2 | hcode(v[1])) m.emit(0x39) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x48 | hcode(v[1]) << 2 | hcode(v[0])) m.emit(0x3b) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPQ m64, r64 if isM64(v0) && isReg64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexm(1, hcode(v[1]), addr(v[0])) m.emit(0x3b) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPQ imm8, m64 if isImm8Ext(v0, 8) && isM64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexm(1, 0, addr(v[1])) m.emit(0x83) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPQ imm32, m64 if isImm32Ext(v0, 8) && isM64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexm(1, 0, addr(v[1])) m.emit(0x81) m.mrsd(7, addr(v[1]), 1) m.imm4(toImmAny(v[0])) }) } // CMPQ r64, m64 if isReg64(v0) && isM64(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexm(1, hcode(v[0]), addr(v[1])) m.emit(0x39) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPQ") } return p }
0.913872
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
CMPB performs "Compare Two Operands". Mnemonic : CMP Supported forms : (6 forms) * CMPB imm8, al * CMPB imm8, r8 * CMPB r8, r8 * CMPB m8, r8 * CMPB imm8, m8 * CMPB r8, m8
func (self *Program) CMPB(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPB", 2, Operands { v0, v1 }) // CMPB imm8, al if isImm8(v0) && v1 == AL { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x3c) m.imm1(toImmAny(v[0])) }) } // CMPB imm8, r8 if isImm8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], isReg8REX(v[1])) m.emit(0x80) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPB r8, r8 if isReg8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x38) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), v[0], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x3a) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPB m8, r8 if isM8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), addr(v[0]), isReg8REX(v[1])) m.emit(0x3a) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPB imm8, m8 if isImm8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x80) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPB r8, m8 if isReg8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), isReg8REX(v[0])) m.emit(0x38) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPB") } return p }
func (self *Program) CMPXCHG8B(v0 interface{}) *Instruction { p := self.alloc("CMPXCHG8B", 1, Operands { v0 }) // CMPXCHG8B m64 if isM64(v0) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[0]), false) m.emit(0x0f) m.emit(0xc7) m.mrsd(1, addr(v[0]), 1) }) } if p.len == 0 { panic("invalid operands for CMPXCHG8B") } return p }
0.815419
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
CMPB performs "Compare Two Operands". Mnemonic : CMP Supported forms : (6 forms) * CMPB imm8, al * CMPB imm8, r8 * CMPB r8, r8 * CMPB m8, r8 * CMPB imm8, m8 * CMPB r8, m8
func (self *Program) CMPB(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPB", 2, Operands { v0, v1 }) // CMPB imm8, al if isImm8(v0) && v1 == AL { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x3c) m.imm1(toImmAny(v[0])) }) } // CMPB imm8, r8 if isImm8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], isReg8REX(v[1])) m.emit(0x80) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPB r8, r8 if isReg8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x38) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), v[0], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x3a) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPB m8, r8 if isM8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), addr(v[0]), isReg8REX(v[1])) m.emit(0x3a) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPB imm8, m8 if isImm8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x80) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPB r8, m8 if isReg8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), isReg8REX(v[0])) m.emit(0x38) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPB") } return p }
func (self *Program) CMPSS(v0 interface{}, v1 interface{}, v2 interface{}) *Instruction { p := self.alloc("CMPSS", 3, Operands { v0, v1, v2 }) // CMPSS imm8, xmm, xmm if isImm8(v0) && isXMM(v1) && isXMM(v2) { self.require(ISA_SSE) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0xf3) m.rexo(hcode(v[2]), v[1], false) m.emit(0x0f) m.emit(0xc2) m.emit(0xc0 | lcode(v[2]) << 3 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPSS imm8, m32, xmm if isImm8(v0) && isM32(v1) && isXMM(v2) { self.require(ISA_SSE) p.domain = DomainMMXSSE p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0xf3) m.rexo(hcode(v[2]), addr(v[1]), false) m.emit(0x0f) m.emit(0xc2) m.mrsd(lcode(v[2]), addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } if p.len == 0 { panic("invalid operands for CMPSS") } return p }
0.807839
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
CMPB performs "Compare Two Operands". Mnemonic : CMP Supported forms : (6 forms) * CMPB imm8, al * CMPB imm8, r8 * CMPB r8, r8 * CMPB m8, r8 * CMPB imm8, m8 * CMPB r8, m8
func (self *Program) CMPB(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPB", 2, Operands { v0, v1 }) // CMPB imm8, al if isImm8(v0) && v1 == AL { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.emit(0x3c) m.imm1(toImmAny(v[0])) }) } // CMPB imm8, r8 if isImm8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, v[1], isReg8REX(v[1])) m.emit(0x80) m.emit(0xf8 | lcode(v[1])) m.imm1(toImmAny(v[0])) }) } // CMPB r8, r8 if isReg8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x38) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), v[0], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x3a) m.emit(0xc0 | lcode(v[1]) << 3 | lcode(v[0])) }) } // CMPB m8, r8 if isM8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[1]), addr(v[0]), isReg8REX(v[1])) m.emit(0x3a) m.mrsd(lcode(v[1]), addr(v[0]), 1) }) } // CMPB imm8, m8 if isImm8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(0, addr(v[1]), false) m.emit(0x80) m.mrsd(7, addr(v[1]), 1) m.imm1(toImmAny(v[0])) }) } // CMPB r8, m8 if isReg8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), isReg8REX(v[0])) m.emit(0x38) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPB") } return p }
func (self *Program) CMPXCHGB(v0 interface{}, v1 interface{}) *Instruction { p := self.alloc("CMPXCHGB", 2, Operands { v0, v1 }) // CMPXCHGB r8, r8 if isReg8(v0) && isReg8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), v[1], isReg8REX(v[0]) || isReg8REX(v[1])) m.emit(0x0f) m.emit(0xb0) m.emit(0xc0 | lcode(v[0]) << 3 | lcode(v[1])) }) } // CMPXCHGB r8, m8 if isReg8(v0) && isM8(v1) { p.domain = DomainGeneric p.add(0, func(m *_Encoding, v []interface{}) { m.rexo(hcode(v[0]), addr(v[1]), isReg8REX(v[0])) m.emit(0x0f) m.emit(0xb0) m.mrsd(lcode(v[0]), addr(v[1]), 1) }) } if p.len == 0 { panic("invalid operands for CMPXCHGB") } return p }
0.7917
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Telefonica/prometheus-kafka-adapter
vendor/github.com/cloudwego/iasm/x86_64/instructions.go
Apache-2.0
go
extractDatabaseFromURI is a helper function to retrieve information about the database from the passed in URI. It accepts as an argument the currently parsed URI and returns the remainder of the uri, the database it found, and any error it encounters while parsing.
func extractDatabaseFromURI(uri string) (extractedDatabase, error) { if len(uri) == 0 { return extractedDatabase{}, nil } if uri[0] != '/' { return extractedDatabase{}, errors.New("must have a / separator between hosts and path") } uri = uri[1:] if len(uri) == 0 { return extractedDatabase{}, nil } database := uri if idx := strings.IndexRune(uri, '?'); idx != -1 { database = uri[:idx] } escapedDatabase, err := url.QueryUnescape(database) if err != nil { return extractedDatabase{}, fmt.Errorf("invalid database %q: %w", database, err) } uri = uri[len(database):] return extractedDatabase{ uri: uri, db: escapedDatabase, }, nil }
func compositedUriInfo(uri string, uriPrefix string) (bool, UriInfo) { if !uriHasPrefix(uri, uriPrefix) { return false, UriInfo{} } //locate user password rest := uri[len(uriPrefix):] seps := strings.Split(rest, "@") if len(seps) != 2 || len(seps[0]) == 0 || len(seps[1]) == 0 { return false, UriInfo{} } seps2 := strings.Split(seps[0], ":") if len(seps2) < 2 { return false, UriInfo{} } userName := strings.Join(seps2[0:len(seps2)-1], ":") password := seps2[len(seps2)-1] passwordStart := len(uriPrefix) + len(userName) + 1 passwordEnd := passwordStart + len(password) if passwordEnd > len(uri) || password != uri[passwordStart:passwordEnd] { return false, UriInfo{} } sep3 := strings.Split(seps[1], ":") if len(sep3) != 2 || len(sep3[0]) == 0 || len(sep3[1]) == 0 { return false, UriInfo{} } ip := sep3[0] port := sep3[1] portInt32, err := strconv.ParseUint(port, 10, 32) if err != nil || portInt32 > 65535 { return false, UriInfo{} } return true, UriInfo{ User: userName, Password: password, Ip: ip, Port: int(portInt32), PasswordStart: passwordStart, PasswordEnd: passwordEnd, } }
0.584786
umputun/tg-spam
vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go
matrixorigin/matrixone
pkg/cdc/util.go
Apache-2.0
go
extractDatabaseFromURI is a helper function to retrieve information about the database from the passed in URI. It accepts as an argument the currently parsed URI and returns the remainder of the uri, the database it found, and any error it encounters while parsing.
func extractDatabaseFromURI(uri string) (extractedDatabase, error) { if len(uri) == 0 { return extractedDatabase{}, nil } if uri[0] != '/' { return extractedDatabase{}, errors.New("must have a / separator between hosts and path") } uri = uri[1:] if len(uri) == 0 { return extractedDatabase{}, nil } database := uri if idx := strings.IndexRune(uri, '?'); idx != -1 { database = uri[:idx] } escapedDatabase, err := url.QueryUnescape(database) if err != nil { return extractedDatabase{}, fmt.Errorf("invalid database %q: %w", database, err) } uri = uri[len(database):] return extractedDatabase{ uri: uri, db: escapedDatabase, }, nil }
func ParseUri(uriStr string) (uri sip.Uri, err error) { if strings.TrimSpace(uriStr) == "*" { // Wildcard '*' URI used in the Contact headers of REGISTERs when unregistering. return sip.WildcardUri{}, nil } colonIdx := strings.Index(uriStr, ":") if colonIdx == -1 { err = fmt.Errorf("no ':' in URI %s", uriStr) return } switch strings.ToLower(uriStr[:colonIdx]) { case "sip": var sipUri sip.SipUri sipUri, err = ParseSipUri(uriStr) uri = &sipUri case "sips": // SIPS URIs have the same form as SIP uris, so we use the same parser. var sipUri sip.SipUri sipUri, err = ParseSipUri(uriStr) uri = &sipUri default: err = fmt.Errorf("unsupported URI schema %s", uriStr[:colonIdx]) } return }
0.579132
umputun/tg-spam
vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go
ghettovoice/gosip
sip/parser/common.go
BSD-2-Clause
go
extractDatabaseFromURI is a helper function to retrieve information about the database from the passed in URI. It accepts as an argument the currently parsed URI and returns the remainder of the uri, the database it found, and any error it encounters while parsing.
func extractDatabaseFromURI(uri string) (extractedDatabase, error) { if len(uri) == 0 { return extractedDatabase{}, nil } if uri[0] != '/' { return extractedDatabase{}, errors.New("must have a / separator between hosts and path") } uri = uri[1:] if len(uri) == 0 { return extractedDatabase{}, nil } database := uri if idx := strings.IndexRune(uri, '?'); idx != -1 { database = uri[:idx] } escapedDatabase, err := url.QueryUnescape(database) if err != nil { return extractedDatabase{}, fmt.Errorf("invalid database %q: %w", database, err) } uri = uri[len(database):] return extractedDatabase{ uri: uri, db: escapedDatabase, }, nil }
func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintptr) uintptr { var p uintptr = uintptr(0) var i int32 if zDatabase != 0 { for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { if Xsqlite3StrICmp(tls, zDatabase, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FzDbSName) == 0 { break } } if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { if Xsqlite3StrICmp(tls, zDatabase, ts+6444) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema+8, zName) if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, ts+6384, 7) == 0 { if i == 1 { if Xsqlite3StrICmp(tls, zName+uintptr(7), ts+6411+7) == 0 || Xsqlite3StrICmp(tls, zName+uintptr(7), ts+6430+7) == 0 || Xsqlite3StrICmp(tls, zName+uintptr(7), ts+5886+7) == 0 { p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema+8, ts+6392) } } else { if Xsqlite3StrICmp(tls, zName+uintptr(7), ts+6430+7) == 0 { p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema+8, ts+5886) } } } } else { p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema+8, zName) if p != 0 { return p } p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema+8, zName) if p != 0 { return p } for i = 2; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema+8, zName) if p != 0 { break } } if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, ts+6384, 7) == 0 { if Xsqlite3StrICmp(tls, zName+uintptr(7), ts+6430+7) == 0 { p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema+8, ts+5886) } else if Xsqlite3StrICmp(tls, zName+uintptr(7), ts+6411+7) == 0 { p = Xsqlite3HashFind(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema+8, ts+6392) } } } return p }
0.550974
umputun/tg-spam
vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go
42wim/matterbridge
vendor/modernc.org/sqlite/lib/sqlite_openbsd_arm64.go
Apache-2.0
go
extractDatabaseFromURI is a helper function to retrieve information about the database from the passed in URI. It accepts as an argument the currently parsed URI and returns the remainder of the uri, the database it found, and any error it encounters while parsing.
func extractDatabaseFromURI(uri string) (extractedDatabase, error) { if len(uri) == 0 { return extractedDatabase{}, nil } if uri[0] != '/' { return extractedDatabase{}, errors.New("must have a / separator between hosts and path") } uri = uri[1:] if len(uri) == 0 { return extractedDatabase{}, nil } database := uri if idx := strings.IndexRune(uri, '?'); idx != -1 { database = uri[:idx] } escapedDatabase, err := url.QueryUnescape(database) if err != nil { return extractedDatabase{}, fmt.Errorf("invalid database %q: %w", database, err) } uri = uri[len(database):] return extractedDatabase{ uri: uri, db: escapedDatabase, }, nil }
func (c *Athena) GetDatabase(input *GetDatabaseInput) (*GetDatabaseOutput, error) { req, out := c.GetDatabaseRequest(input) return out, req.Send() }
0.535568
umputun/tg-spam
vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go
aws/aws-sdk-go
service/athena/api.go
Apache-2.0
go
extractDatabaseFromURI is a helper function to retrieve information about the database from the passed in URI. It accepts as an argument the currently parsed URI and returns the remainder of the uri, the database it found, and any error it encounters while parsing.
func extractDatabaseFromURI(uri string) (extractedDatabase, error) { if len(uri) == 0 { return extractedDatabase{}, nil } if uri[0] != '/' { return extractedDatabase{}, errors.New("must have a / separator between hosts and path") } uri = uri[1:] if len(uri) == 0 { return extractedDatabase{}, nil } database := uri if idx := strings.IndexRune(uri, '?'); idx != -1 { database = uri[:idx] } escapedDatabase, err := url.QueryUnescape(database) if err != nil { return extractedDatabase{}, fmt.Errorf("invalid database %q: %w", database, err) } uri = uri[len(database):] return extractedDatabase{ uri: uri, db: escapedDatabase, }, nil }
func (c *SsmSap) GetDatabase(input *GetDatabaseInput) (*GetDatabaseOutput, error) { req, out := c.GetDatabaseRequest(input) return out, req.Send() }
0.532379
umputun/tg-spam
vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go
aws/aws-sdk-go
service/ssmsap/api.go
Apache-2.0
go