@Override public VertexLabelBuilder idStrategy(IdStrategy idStrategy) { E.checkArgument(this.idStrategy == IdStrategy.DEFAULT || this.idStrategy == idStrategy, "Not allowed to change id strategy for " + "vertex label '%s'", this.name); this.idStrategy = idStrategy; return this; }
@Override public void checkCreate(boolean isBatch) { E.checkArgumentNotNull(this.name, "The name of property key can't be null"); E.checkArgument(this.properties == null || this.properties.length == 0, "Not allowed to pass properties when " + "creating property key since it doesn't " + "support meta properties currently"); }
@Override public VertexLabelBuilder usePrimaryKeyId() { E.checkArgument(this.idStrategy == IdStrategy.DEFAULT || this.idStrategy == IdStrategy.PRIMARY_KEY, "Not allowed to change id strategy for " + "vertex label '%s'", this.name); this.idStrategy = IdStrategy.PRIMARY_KEY; return this; }
@Override public void checkCreate(boolean isBatch) { E.checkArgumentNotNull(this.gremlin, "The gremlin parameter can't be null"); E.checkArgumentNotNull(this.language, "The language parameter can't be null"); E.checkArgument(this.aliases == null || this.aliases.isEmpty(), "There is no need to pass gremlin aliases"); }
private static void checkPositive(int value, String name) { E.checkArgument(value > 0, "The %s parameter must be > 0, but got '%s'", name, value); }
private static void checkPositiveOrNoLimit(long value, String name) { E.checkArgument(value > 0 || value == NO_LIMIT, "The %s parameter must be > 0 or == %s, but got: %s", name, NO_LIMIT, value); }
public BytesBuffer(int capacity) { E.checkArgument(capacity <= MAX_BUFFER_CAPACITY, "Capacity exceeds max buffer capacity: %s", MAX_BUFFER_CAPACITY); this.buffer = ByteBuffer.allocate(capacity); }
protected Iterator<BackendEntry> dropTails(Iterator<BackendEntry> iterator, long limit) { E.checkArgument(limit <= Integer.MAX_VALUE, "Limit must be <= 0x7fffffff, but got '%s'", limit); List<BackendEntry> entries = new ArrayList<>((int) limit); for (long i = 0L; i < limit && iterator.hasNext(); i++) { entries.add(iterator.next()); } return entries.iterator(); }
private static int[] parseFileName(String fileName) { String[] nameParts = fileName.split("-"); E.checkArgument(nameParts.length == 2, "Invalid file name format '%s' for palo temp file, " + "the legal format is session{m}-part{n}", fileName); int[] rs = new int[2]; rs[0] = Integer.parseInt(nameParts[0].substring("session".length())); rs[1] = Integer.parseInt(nameParts[1].substring("part".length())); return rs; }
@Override public EdgeLabelBuilder id(long id) { E.checkArgument(id != 0L, "Not allowed to assign 0 as edge label id"); this.id = IdGenerator.of(id); return this; }
@Override public VertexLabelBuilder id(long id) { E.checkArgument(id != 0L, "Not allowed to assign 0 as vertex label id"); this.id = IdGenerator.of(id); return this; }
public static int getAsciiByteLength(String attribute) { E.checkArgument(CharMatcher.ascii().matchesAllOf(attribute), "'%s' must be ASCII string", attribute); return attribute.isEmpty() ? 1 : attribute.length(); }
public VertexLabel vertexLabel(Id id) { VertexLabel vl = this.schemaTransaction().getVertexLabel(id); E.checkArgument(vl != null, "Undefined vertex label id: '%s'", id); return vl; }
public IndexLabel indexLabel(Id id) { IndexLabel il = this.schemaTransaction().getIndexLabel(id); E.checkArgument(il != null, "Undefined index label id: '%s'", id); return il; }
@Override protected void registerMetaHandlers() { this.registerMetaHandler("splits", (session, meta, args) -> { E.checkArgument(args.length == 1, "The args count of %s must be 1", meta); long splitSize = (long) args[0]; return this.shardSpliter.getSplits(session, splitSize); }); }
public PropertyKey propertyKey(Id id) { PropertyKey pk = this.schemaTransaction().getPropertyKey(id); E.checkArgument(pk != null, "Undefined property key id: '%s'", id); return pk; }
public EdgeLabel edgeLabel(Id id) { EdgeLabel el = this.schemaTransaction().getEdgeLabel(id); E.checkArgument(el != null, "Undefined edge label id: '%s'", id); return el; }
public VertexLabel vertexLabel(String name) { VertexLabel vl = this.schemaTransaction().getVertexLabel(name); E.checkArgument(vl != null, "Undefined vertex label: '%s'", name); return vl; }
public EdgeLabel edgeLabel(String name) { EdgeLabel el = this.schemaTransaction().getEdgeLabel(name); E.checkArgument(el != null, "Undefined edge label: '%s'", name); return el; }
@DELETE @Timed @Path("{id}") public void delete(@Context GraphManager manager, @PathParam("graph") String graph, @PathParam("id") long id) { LOG.debug("Graph [{}] delete task: {}", graph, id); TaskScheduler scheduler = graph(manager, graph).taskScheduler(); HugeTask<?> task = scheduler.deleteTask(IdGenerator.of(id)); E.checkArgument(task != null, "There is no task with id '%s'", id); }