Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for InCapacity (0.23 sec)

  1. internal/grid/handlers.go

    		Subroute string
    
    		// OutCapacity is the output capacity. If <= 0 capacity will be 1.
    		OutCapacity int
    
    		// InCapacity is the output capacity.
    		// If == 0 no input is expected
    		InCapacity int
    	}
    )
    
    type subHandlerID [32]byte
    
    func makeSubHandlerID(id HandlerID, subRoute string) subHandlerID {
    	b := subHandlerID(sha256.Sum256([]byte(subRoute)))
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 26.9K bytes
    - Viewed (0)
  2. internal/grid/grid_test.go

    					b := append([]byte{}, payload...)
    					b = append(b, in...)
    					resp <- b
    				}
    				t.Log(GetCaller(ctx).Name, "Handler done")
    				return nil
    			},
    			OutCapacity: 1,
    			InCapacity:  1,
    		}))
    		// 2: Return as error
    		errFatal(manager.RegisterStreamingHandler(handlerTest2, StreamHandler{
    			Handle: func(ctx context.Context, payload []byte, request <-chan []byte, resp chan<- []byte) *RemoteErr {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Feb 08 18:15:27 GMT 2024
    - 30.1K bytes
    - Viewed (0)
  3. internal/grid/README.md

            return nil
        }
    
        err := manager.RegisterStreamingHandler(grid.HandlerDiskInfo, StreamHandler{
            Handle: handler,
            Subroute: "asubroute",
            OutCapacity: 1,
            InCapacity: 1,
        })
    ```
    
    Sample call:
    ```go
        // Get a connection to the remote host
        conn := manager.Connection(host).Subroute("asubroute")
    	
        payload := []byte("request")
    Plain Text
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 9.4K bytes
    - Viewed (0)
  4. internal/grid/benchmark_test.go

    					case <-ctx.Done():
    						return nil
    					case out <- toSend:
    					}
    				}
    				return nil
    			},
    
    			Subroute:    "some-subroute",
    			OutCapacity: 1, // Only one message buffered.
    			InCapacity:  0,
    		}))
    		errFatal(err)
    	}
    	const payloadSize = 512
    	rng := rand.New(rand.NewSource(time.Now().UnixNano()))
    	payload := make([]byte, payloadSize)
    	_, err = rng.Read(payload)
    	errFatal(err)
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Tue Nov 21 01:09:35 GMT 2023
    - 12.2K bytes
    - Viewed (0)
  5. internal/grid/connection_test.go

    			gotCall <- struct{}{}
    			select {
    			case <-ctx.Done():
    				gotCall <- struct{}{}
    			case <-cleanReqs:
    				panic("should not be called")
    			}
    			return nil
    		},
    		OutCapacity: 1,
    		InCapacity:  1,
    	}
    	errFatal(remote.RegisterSingleHandler(handlerTest, h1))
    	errFatal(remote.RegisterStreamingHandler(handlerTest2, h2))
    	errFatal(local.RegisterSingleHandler(handlerTest, h1))
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Tue Nov 21 01:09:35 GMT 2023
    - 6K bytes
    - Viewed (0)
  6. internal/grid/connection.go

    	}
    	handler := c.handlers.streams[h]
    	if handler == nil {
    		return nil, ErrUnknownHandler
    	}
    
    	var requests chan []byte
    	var responses chan Response
    	if handler.InCapacity > 0 {
    		requests = make(chan []byte, handler.InCapacity)
    	}
    	if handler.OutCapacity > 0 {
    		responses = make(chan Response, handler.OutCapacity)
    	} else {
    		responses = make(chan Response, 1)
    	}
    
    	cl, err := c.newMuxClient(ctx)
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 42.6K bytes
    - Viewed (0)
  7. internal/grid/muxserver.go

    		ctx, cancel = context.WithTimeout(ctx, time.Duration(msg.DeadlineMS)*time.Millisecond+c.addDeadline)
    	} else {
    		ctx, cancel = context.WithCancel(ctx)
    	}
    
    	send := make(chan []byte)
    	inboundCap, outboundCap := handler.InCapacity, handler.OutCapacity
    	if outboundCap <= 0 {
    		outboundCap = 1
    	}
    
    	m := muxServer{
    		ID:        msg.MuxID,
    		RecvSeq:   msg.Seq + 1,
    		SendSeq:   msg.Seq,
    		ctx:       ctx,
    		cancel:    cancel,
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  8. cmd/peer-rest-server.go

    	logger.FatalIf(gm.RegisterStreamingHandler(grid.HandlerTrace, grid.StreamHandler{
    		Handle:      server.TraceHandler,
    		Subroute:    "",
    		OutCapacity: 100000,
    		InCapacity:  0,
    	}), "unable to register handler")
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 51.8K bytes
    - Viewed (0)
Back to top