Package io.fathom.cloud.state.StateStore

Examples of io.fathom.cloud.state.StateStore.StateNode


        return new NamedItemCollection<BucketData>(node, BucketData.newBuilder(), BucketData.getDescriptor()
                .findFieldByNumber(BucketData.KEY_FIELD_NUMBER));
    }

    public NumberedItemCollection<DirectoryData> getDirectories(long projectId) {
        StateNode root = stateStore.getRoot("dir");
        StateNode node = root.child(Long.toHexString(projectId));

        return new NumberedItemCollection<DirectoryData>(node, DirectoryData.newBuilder(), DirectoryData
                .getDescriptor().findFieldByNumber(DirectoryData.ID_FIELD_NUMBER));
    }
View Full Code Here


    // HostInfo.getDescriptor()
    // .findFieldByNumber(HostInfo.ID_FIELD_NUMBER));
    // }

    public NumberedItemCollection<HostGroupData> getHostGroups() {
        StateNode root = stateStore.getRoot("netmap");
        StateNode groups = root.child("groups");

        return new NumberedItemCollection<HostGroupData>(groups, HostGroupData.newBuilder(), HostGroupData
                .getDescriptor().findFieldByNumber(HostGroupData.ID_FIELD_NUMBER));
    }
View Full Code Here

        return new NumberedItemCollection<HostGroupData>(groups, HostGroupData.newBuilder(), HostGroupData
                .getDescriptor().findFieldByNumber(HostGroupData.ID_FIELD_NUMBER));
    }

    public NumberedItemCollection<HostData> getHosts() {
        StateNode root = stateStore.getRoot("netmap");
        StateNode hosts = root.child("hosts");

        return new NumberedItemCollection<HostData>(hosts, HostData.newBuilder(), HostData.getDescriptor()
                .findFieldByNumber(HostData.ID_FIELD_NUMBER));
    }
View Full Code Here

        }
        return ret;
    }

    public T find(long itemId, StoreOptions... options) throws CloudException {
        StateNode itemNode = parentNode.child(Long.toHexString(itemId));

        T t = (T) deserialize(itemNode, template.clone());
        if (t != null && usesItemState() && !showDeleted(options) && ItemStates.isDeleted(t)) {
            return null;
        }
View Full Code Here

        }
        return t;
    }

    public Watched<T> watch(long itemId) throws CloudException {
        StateNode itemNode = parentNode.child(Long.toHexString(itemId));

        SettableFuture<Object> future = SettableFuture.create();

        T t = (T) deserialize(itemNode, template.clone(), future);
        if (t != null && usesItemState() && ItemStates.isDeleted(t)) {
View Full Code Here

            try {
                data = codec.serialize(built);
            } catch (IOException e) {
                throw new CloudException("Error serializing data", e);
            }
            StateNode node = parentNode.child(Long.toHexString(id));

            if (!node.create(data)) {
                continue;
            }

            return (T) built;
        }
View Full Code Here

        }

        if (!this.primaryKeyIndex.allowDelete()) {
            throw new UnsupportedOperationException();
        }
        StateNode itemNode = parentNode.child(Long.toHexString(itemId));

        T v = (T) deserialize(itemNode, template.clone());
        if (v == null) {
            return null;
        }

        if (!itemNode.delete()) {
            throw new IllegalStateException();
        }

        return v;
    }
View Full Code Here

        long id = ((Number) item.getField(idField)).longValue();
        if (id == 0) {
            throw new IllegalArgumentException();
        }

        StateNode node = parent.child(Long.toHexString(id));

        return update(node, item);
    }
View Full Code Here

        }
        return ret;
    }

    public void delete(String name) throws StateStoreException {
        StateNode node = getNode(name);

        node.delete();
    }
View Full Code Here

        node.delete();
    }

    public T find(String name) throws CloudException {
        StateNode node = getNode(name);

        T t = (T) deserialize(node, template.clone());
        if (t != null && usesItemState() && ItemStates.isDeleted(t)) {
            return null;
        }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.state.StateStore.StateNode

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.