syncbase/src/main/java/io/v/syncbase/Syncgroup.java
/**
     * FOR ADVANCED USERS. Applies {@code delta} to the {@code AccessList}.
     */
FOR ADVANCED USERS. Applies  delta to the  AccessList.
FOR ADVANCED USERS . Applies delta to the AccessList .
public void updateAccessList(final AccessList delta, UpdateAccessListOptions opts)
            throws SyncbaseException {
        try {
            VersionedSyncgroupSpec versionedSyncgroupSpec = mCoreSyncgroup.getSpec();
            versionedSyncgroupSpec.syncgroupSpec.permissions = AccessList.applyDeltaForSyncgroup(
                    versionedSyncgroupSpec.syncgroupSpec.permissions, delta);
            mCoreSyncgroup.setSpec(versionedSyncgroupSpec);
            if (!opts.syncgroupOnly) {
                final List<io.v.syncbase.core.Id> collectionsIds =
                        versionedSyncgroupSpec.syncgroupSpec.collections;
                mDatabase.runInBatch(new Database.BatchOperation() {
                    @Override
                    public void run(BatchDatabase db) throws SyncbaseException {
                        for (io.v.syncbase.core.Id id : collectionsIds) {
                            db.getCollection(new Id(id)).updateAccessList(delta);
                        }
                    }
                });
            }
        } catch (VError e) {
            chainThrow("updating access list of syncgroup", getId().getName(), e);
        }
    }
public void updateAccessList ( final AccessList delta , UpdateAccessListOptions opts ) throws SyncbaseException { try { VersionedSyncgroupSpec versionedSyncgroupSpec = mCoreSyncgroup . getSpec ( ) ; versionedSyncgroupSpec . syncgroupSpec . permissions = AccessList . applyDeltaForSyncgroup ( versionedSyncgroupSpec . syncgroupSpec . permissions , delta ) ; mCoreSyncgroup . setSpec ( versionedSyncgroupSpec ) ; if ( ! opts . syncgroupOnly ) { final List < io . v . syncbase . core . Id > collectionsIds = versionedSyncgroupSpec . syncgroupSpec . collections ; mDatabase . runInBatch ( new Database . BatchOperation ( ) { @ Override public void run ( BatchDatabase db ) throws SyncbaseException { for ( io . v . syncbase . core . Id id : collectionsIds ) { db . getCollection ( new Id ( id ) ) . updateAccessList ( delta ) ; } } } ) ; } } catch ( VError e ) { chainThrow ( "updating access list of syncgroup" , getId ( ) . getName ( ) , e ) ; } }
FOR ADVANCED USERS.
FOR ADVANCED USERS .
// TODO(sadovsky): Make it so SyncgroupSpec can be updated as part of a batch? // TODO(sadovsky): There's a race here - it's possible for a collection to get // destroyed after getSpec() but before db.getCollection().