@Override public void merge(RoutingContext context) { DocumentProtocol.merge(context); }
/** * Convenience method to call {@link #putRoutableFactory(int, RoutableFactory, com.yahoo.component.VersionSpecification)} * for multiple version specifications. * * @param type The routable type to assign a factory to. * @param factory The factory to add. * @param versions The versions for which this factory can be used. * @return This, to allow chaining. */ public DocumentProtocol putRoutableFactory(int type, RoutableFactory factory, List<VersionSpecification> versions) { for (VersionSpecification version : versions) { putRoutableFactory(type, factory, version); } return this; }
putRoutingPolicyFactory("AND", new RoutingPolicyFactories.AndPolicyFactory()); putRoutingPolicyFactory("Content", new RoutingPolicyFactories.ContentPolicyFactory()); putRoutingPolicyFactory("DocumentRouteSelector", new RoutingPolicyFactories.DocumentRouteSelectorPolicyFactory(cfg)); putRoutingPolicyFactory("Extern", new RoutingPolicyFactories.ExternPolicyFactory()); putRoutingPolicyFactory("LocalService", new RoutingPolicyFactories.LocalServicePolicyFactory()); putRoutingPolicyFactory("MessageType", new RoutingPolicyFactories.MessageTypePolicyFactory(cfg)); putRoutingPolicyFactory("RoundRobin", new RoutingPolicyFactories.RoundRobinPolicyFactory()); putRoutingPolicyFactory("LoadBalancer", new RoutingPolicyFactories.LoadBalancerPolicyFactory()); putRoutingPolicyFactory("Storage", new RoutingPolicyFactories.StoragePolicyFactory()); putRoutingPolicyFactory("SubsetService", new RoutingPolicyFactories.SubsetServicePolicyFactory()); putRoutableFactory(MESSAGE_CREATEVISITOR, new RoutableFactories60.CreateVisitorMessageFactory(), from6); putRoutableFactory(MESSAGE_DESTROYVISITOR, new RoutableFactories60.DestroyVisitorMessageFactory(), from6); putRoutableFactory(MESSAGE_DOCUMENTLIST, new RoutableFactories60.DocumentListMessageFactory(), from6); putRoutableFactory(MESSAGE_DOCUMENTSUMMARY, new RoutableFactories60.DocumentSummaryMessageFactory(), from6); putRoutableFactory(MESSAGE_EMPTYBUCKETS, new RoutableFactories60.EmptyBucketsMessageFactory(), from6); putRoutableFactory(MESSAGE_GETBUCKETLIST, new RoutableFactories60.GetBucketListMessageFactory(), from6); putRoutableFactory(MESSAGE_GETBUCKETSTATE, new RoutableFactories60.GetBucketStateMessageFactory(), from6); putRoutableFactory(MESSAGE_GETDOCUMENT, new RoutableFactories60.GetDocumentMessageFactory(), from6); putRoutableFactory(MESSAGE_MAPVISITOR, new RoutableFactories60.MapVisitorMessageFactory(), from6); putRoutableFactory(MESSAGE_PUTDOCUMENT, new RoutableFactories60.PutDocumentMessageFactory(), from6); putRoutableFactory(MESSAGE_QUERYRESULT, new RoutableFactories60.QueryResultMessageFactory(), from6); putRoutableFactory(MESSAGE_REMOVEDOCUMENT, new RoutableFactories60.RemoveDocumentMessageFactory(), from6); putRoutableFactory(MESSAGE_REMOVELOCATION, new RoutableFactories60.RemoveLocationMessageFactory(), from6); putRoutableFactory(MESSAGE_SEARCHRESULT, new RoutableFactories60.SearchResultMessageFactory(), from6); putRoutableFactory(MESSAGE_STATBUCKET, new RoutableFactories60.StatBucketMessageFactory(), from6); putRoutableFactory(MESSAGE_UPDATEDOCUMENT, new RoutableFactories60.UpdateDocumentMessageFactory(), from6); putRoutableFactory(MESSAGE_VISITORINFO, new RoutableFactories60.VisitorInfoMessageFactory(), from6); putRoutableFactory(REPLY_CREATEVISITOR, new RoutableFactories60.CreateVisitorReplyFactory(), from6);
public Routable decode(DocumentDeserializer in, LoadTypeSet loadTypes) { byte pri = in.getByte(null); DocumentReply reply = doDecode(in); if (reply != null) { reply.setPriority(DocumentProtocol.getPriority(pri)); } return reply; } }
private static String getErrorMessage(Error r) { return DocumentProtocol.getErrorName(r.getCode()) + ": " + r.getMessage(); }
private boolean handleReplyWithOnlyIgnoredErrors(Reply r) { if (DocumentProtocol.hasOnlyErrorsOfType(r, DocumentProtocol.ERROR_MESSAGE_IGNORED)) { if (ignore == null) { ignore = new EmptyReply(); } ignore.addError(r.getError(0)); return true; } return false; }
/** * Creates a new document access using the supplied parameters. * * @param params All parameters for construction. */ public MessageBusDocumentAccess(MessageBusParams params) { super(params); this.params = params; try { com.yahoo.messagebus.MessageBusParams mbusParams = new com.yahoo.messagebus.MessageBusParams(params.getMessageBusParams()); mbusParams.addProtocol(new DocumentProtocol(getDocumentTypeManager(), params.getProtocolConfigId(), params.getLoadTypes())); if (System.getProperty("vespa.local", "false").equals("true")) { // set by Application when running locally LocalNetwork network = new LocalNetwork(); bus = new NetworkMessageBus(network, new MessageBus(network, mbusParams)); } else { bus = new RPCMessageBus(mbusParams, params.getRPCNetworkParams(), params.getRoutingConfigId()); } } catch (Exception e) { throw new DocumentAccessException(e); } }
params.setPriority(DocumentProtocol.getPriorityByName( query.properties().getString(streamingPriority)));
public Routable decode(DocumentDeserializer in, LoadTypeSet loadTypes) { byte pri = in.getByte(null); int loadType = in.getInt(null); DocumentMessage msg = doDecode(in); if (msg != null) { msg.setPriority(DocumentProtocol.getPriority(pri)); msg.setLoadType(loadTypes.getIdMap().get(loadType)); } return msg; } }
public void merge(RoutingContext ctx) { DocumentProtocol.merge(ctx); }
@Override public void merge(RoutingContext ctx) { DocumentProtocol.merge(ctx); }
@Override public void merge(RoutingContext context) { DocumentProtocol.merge(context); }
public void merge(RoutingContext ctx) { DocumentProtocol.merge(ctx); }
public void merge(RoutingContext ctx) { DocumentProtocol.merge(ctx); }
public void merge(RoutingContext context) { DocumentProtocol.merge(context); }
/** * This method implements the common way to merge document replies for whatever routing policy. In case of an error * in any of the replies, it will prepare an EmptyReply() and add all errors to it. If there are no errors, this * method will use the first reply in the list and transfer whatever feed answers might exist in the replies to it. * * * @param replies The replies to merge. * @return The merged Reply. */ public static Reply merge(List<Reply> replies) { return merge(replies, new HashSet<Integer>(0)).second; }
/** * This is a convenient entry to the {@link #merge(RoutingContext,Set)} method by way of a routing context object. * The replies of all child contexts are merged and stored in the context. * * @param ctx The context whose children to merge. */ public static void merge(RoutingContext ctx) { merge(ctx, new HashSet<Integer>(0)); }
/** * This method implements the common way to merge document replies for whatever routing policy. In case of an error * in any of the replies, it will prepare an EmptyReply() and add all errors to it. If there are no errors, this * method will use the first reply in the list and transfer whatever feed answers might exist in the replies to it. * * @param ctx The context whose children to merge. * @param mask The indexes of the children to skip. */ public static void merge(RoutingContext ctx, Set<Integer> mask) { List<Reply> replies = new LinkedList<>(); for (RoutingNodeIterator it = ctx.getChildIterator(); it.isValid(); it.next()) { Reply ref = it.getReplyRef(); replies.add(ref); } Tuple2<Integer, Reply> tuple = merge(replies, mask); if (tuple.first != null) { ctx.getChildIterator().skip(tuple.first).removeReply(); } ctx.setReply(tuple.second); }
@Override public ContentChannel handleResponse(Response response) { synchronized (this) { if (response instanceof MbusResponse) { Reply reply = ((MbusResponse)response).getReply(); requestTrace.addChild(reply.getTrace().getRoot()); replies.add(reply); } if (--numPending != 0) { return null; } } requestMsg.getTrace().getRoot().addChild(requestTrace); Reply reply = DocumentProtocol.merge(replies); Response mbusResponse = new MbusResponse(StatusCodes.fromMbusReply(reply), reply); ResponseDispatch.newInstance(mbusResponse).dispatch(responseHandler); return null; }