Package com.basho.riak.client.query.functions

Examples of com.basho.riak.client.query.functions.NamedErlangFunction


    }

    private static void writeNamedFun(JsonGenerator jg, NamedFunction nf) throws IOException {
        jg.writeStartObject();
        if(nf instanceof NamedErlangFunction) {
            NamedErlangFunction nef = (NamedErlangFunction)nf;
            jg.writeStringField(Constants.FL_SCHEMA_FUN_MOD, nef.getMod());
            jg.writeStringField(Constants.FL_SCHEMA_FUN_FUN, nef.getFun());
        } else {
            NamedJSFunction njsf = (NamedJSFunction)nf;
            jg.writeStringField(Constants.FL_SCHEMA_FUN_NAME, njsf.getFunction());
        }
        jg.writeEndObject();
View Full Code Here


                    // results into the correct steps when they come back
                    mr.addInput(input.get(0), input.get(1), Integer.toString(stepCnt));
                }
            }

            mr.addReducePhase(new NamedErlangFunction("riak_kv_mapreduce", "reduce_set_union"), false);
            mr.addMapPhase(new JSSourceFunction("function(v, keyData) { return [{\"step\": keyData, \"v\": v}]; }"),
                           true);

            return mr.execute();
        } catch (ConversionException e) {
View Full Code Here

        if (fun.length != 2) {
            return null;
        }

        return new NamedErlangFunction(fun[0], fun[1]);
    }
View Full Code Here

    }

    private static void writeNamedFun(JsonGenerator jg, NamedFunction nf) throws IOException {
        jg.writeStartObject();
        if(nf instanceof NamedErlangFunction) {
            NamedErlangFunction nef = (NamedErlangFunction)nf;
            jg.writeStringField(Constants.FL_SCHEMA_FUN_MOD, nef.getMod());
            jg.writeStringField(Constants.FL_SCHEMA_FUN_FUN, nef.getFun());
        } else {
            NamedJSFunction njsf = (NamedJSFunction)nf;
            jg.writeStringField(Constants.FL_SCHEMA_FUN_NAME, njsf.getFunction());
        }
        jg.writeEndObject();
View Full Code Here

       
            for (CommitHook hook : properties.getPrecommitHooks()) {
                if (hook.isJavascript()) {
                    builder.addPrecommitHook(new NamedJSFunction(hook.getJsName()));
                } else {
                    builder.addPrecommitHook(new NamedErlangFunction(hook.getErlModule(),
                                                                     hook.getErlFunction()));
                }
            }
       
            for (CommitHook hook : properties.getPostcommitHooks()) {
                if (hook.isJavascript()) {
                    throw new IllegalArgumentException("Post-commit hooks can only be erlang");
                } else {
                    builder.addPostcommitHook(new NamedErlangFunction(hook.getErlModule(),
                                                                     hook.getErlFunction()));
                }
            }
           
            if (properties.getcHashFun() != null) {
                builder.chashKeyFunction(new NamedErlangFunction(properties.getcHashFun().getModule(),
                                                                 properties.getcHashFun().getFunction()));
            }
           
            if (properties.getLinkFun() != null) {
                builder.linkWalkFunction(new NamedErlangFunction(properties.getLinkFun().getModule(),
                                                                 properties.getLinkFun().getFunction()));
            }
           
            return builder.build();
    }
View Full Code Here

                        mr.addInput(input.get(0), input.get(1), Integer.toString(stepCnt));
                    }
                }
            }

            mr.addReducePhase(new NamedErlangFunction("riak_kv_mapreduce", "reduce_set_union"), false);
            mr.addMapPhase(new JSSourceFunction("function(v, keyData) { return [{\"step\": keyData, \"v\": v}]; }"),
                           true);

            return mr.execute();
        } catch (ConversionException e) {
View Full Code Here

                    // results into the correct steps when they come back
                    mr.addInput(input.get(0), input.get(1), Integer.toString(stepCnt));
                }
            }

            mr.addReducePhase(new NamedErlangFunction("riak_kv_mapreduce", "reduce_set_union"), false);
            mr.addMapPhase(new JSSourceFunction("function(v, keyData) { return [{\"step\": keyData, \"v\": v}]; }"),
                           true);

            return mr.execute();
        } catch (ConversionException e) {
View Full Code Here

                    // results into the correct steps when they come back
                    mr.addInput(input.get(0), input.get(1), Integer.toString(stepCnt));
                }
            }

            mr.addReducePhase(new NamedErlangFunction("riak_kv_mapreduce", "reduce_set_union"), false);
            mr.addMapPhase(new JSSourceFunction("function(v, keyData) { return [{\"step\": keyData, \"v\": v}]; }"),
                           true);

            return mr.execute();
        } catch (ConversionException e) {
View Full Code Here

        if (fun.length != 2) {
            return null;
        }

        return new NamedErlangFunction(fun[0], fun[1]);
    }
View Full Code Here

    }

    private static void writeNamedFun(JsonGenerator jg, NamedFunction nf) throws IOException {
        jg.writeStartObject();
        if(nf instanceof NamedErlangFunction) {
            NamedErlangFunction nef = (NamedErlangFunction)nf;
            jg.writeStringField(Constants.FL_SCHEMA_FUN_MOD, nef.getMod());
            jg.writeStringField(Constants.FL_SCHEMA_FUN_FUN, nef.getFun());
        } else {
            NamedJSFunction njsf = (NamedJSFunction)nf;
            jg.writeStringField(Constants.FL_SCHEMA_FUN_NAME, njsf.getFunction());
        }
        jg.writeEndObject();
View Full Code Here

TOP

Related Classes of com.basho.riak.client.query.functions.NamedErlangFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.