Search in sources :

Example 26 with Cursor

use of com.yahoo.slime.Cursor in project vespa by vespa-engine.

the class ContentHandler method createResponse.

private HttpResponse createResponse(ContentRequest request) {
    Slime slime = new Slime();
    Cursor root = slime.setObject();
    root.setString("prepared", request.getUrlBase("/prepared"));
    return new SessionResponse(slime, root);
}
Also used : Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor)

Example 27 with Cursor

use of com.yahoo.slime.Cursor in project vespa by vespa-engine.

the class ConfigChangeActionsSlimeConverter method refeedActionsToSlime.

private void refeedActionsToSlime(Cursor actionsCursor) {
    Cursor refeedCursor = actionsCursor.setArray("refeed");
    for (RefeedActions.Entry entry : actions.getRefeedActions().getEntries()) {
        Cursor entryCursor = refeedCursor.addObject();
        entryCursor.setString("name", entry.name());
        entryCursor.setBool("allowed", entry.allowed());
        entryCursor.setString("documentType", entry.getDocumentType());
        entryCursor.setString("clusterName", entry.getClusterName());
        messagesToSlime(entryCursor, entry.getMessages());
        servicesToSlime(entryCursor, entry.getServices());
    }
}
Also used : Cursor(com.yahoo.slime.Cursor)

Example 28 with Cursor

use of com.yahoo.slime.Cursor in project vespa by vespa-engine.

the class ConfigChangeActionsSlimeConverter method restartActionsToSlime.

private void restartActionsToSlime(Cursor actionsCursor) {
    Cursor restartCursor = actionsCursor.setArray("restart");
    for (RestartActions.Entry entry : actions.getRestartActions().getEntries()) {
        Cursor entryCursor = restartCursor.addObject();
        entryCursor.setString("clusterName", entry.getClusterName());
        entryCursor.setString("clusterType", entry.getClusterType());
        entryCursor.setString("serviceType", entry.getServiceType());
        messagesToSlime(entryCursor, entry.getMessages());
        servicesToSlime(entryCursor, entry.getServices());
    }
}
Also used : Cursor(com.yahoo.slime.Cursor)

Example 29 with Cursor

use of com.yahoo.slime.Cursor in project vespa by vespa-engine.

the class SlimeTraceSerializer method addChildrenCursors.

private void addChildrenCursors(Cursor current, TraceNode node) {
    Iterator<TraceNode> it = node.children().iterator();
    if (it.hasNext()) {
        Cursor childrenArray = current.setArray(CHILDREN);
        while (it.hasNext()) {
            cursors.push(childrenArray.addObject());
            it.next();
        }
    }
}
Also used : TraceNode(com.yahoo.yolean.trace.TraceNode) Cursor(com.yahoo.slime.Cursor)

Example 30 with Cursor

use of com.yahoo.slime.Cursor in project vespa by vespa-engine.

the class SlimeTraceSerializer method visit.

@Override
public void visit(TraceNode node) {
    Cursor current = cursors.pop();
    current.setLong(TIMESTAMP, node.timestamp());
    encodePayload(current, node.payload());
    addChildrenCursors(current, node);
}
Also used : Cursor(com.yahoo.slime.Cursor)

Aggregations

Cursor (com.yahoo.slime.Cursor)112 Slime (com.yahoo.slime.Slime)79 Test (org.junit.Test)33 SlimeJsonResponse (com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse)19 ByteArrayOutputStream (java.io.ByteArrayOutputStream)17 DefParser (com.yahoo.config.codegen.DefParser)15 InnerCNode (com.yahoo.config.codegen.InnerCNode)15 StringReader (java.io.StringReader)15 IOException (java.io.IOException)9 ApplicationId (com.yahoo.config.provision.ApplicationId)8 JsonFormat (com.yahoo.slime.JsonFormat)8 Application (com.yahoo.vespa.hosted.controller.Application)6 List (java.util.List)6 Map (java.util.Map)6 Inspector (com.yahoo.slime.Inspector)5 SlimeUtils (com.yahoo.vespa.config.SlimeUtils)5 Ignore (org.junit.Ignore)5 Version (com.yahoo.component.Version)4 RegionName (com.yahoo.config.provision.RegionName)4 TenantName (com.yahoo.config.provision.TenantName)4