////////////////////////////////////////////////////////////////////////////
// RaftStore methods
////////////////////////////////////////////////////////////////////////////
// CreateChannel implements the Store interface
190266
func (s *RaftStore) CreateChannel(channel string) (*Channel, error) {
	s.Lock()
	defer s.Unlock()
	c, err := s.Store.CreateChannel(channel)
	if err != nil {
		return nil, err
	}
	c.Subs = s.replaceSubStore(channel, c.Subs, 0)
	return c, nil
}
991379
public static void validateClusterStores(final Cluster cluster,
                                             final List<StoreDefinition> storeDefs) {
        // Constructing a StoreRoutingPlan has the (desirable in this
        // case) side-effect of verifying that the store definition is congruent
        // with the cluster definition. If there are issues, exceptions are
        // thrown.
        for(StoreDefinition storeDefinition: storeDefs) {
            new StoreRoutingPlan(cluster, storeDefinition);
        }
        return;
    }
55958
function createRemote(item, store) {
      // Check existing item id property;
      var itemId = item[store.idProperty];
      // Store resources url
      var url = !itemId ? store._rootUrl : store._rootUrl + "/" + itemId;
      // Set up request
      var xhr = new XMLHttpRequest();
      xhr.open("POST", url, true);
      xhr.setRequestHeader("Content-Type", "application/json");
      // Request callback
      xhr.onload = function(e) {
        // If operation has been completed - ready state 4
        if (xhr.readyState === 4) {
          // Response status successfully completed - status 200
          if (xhr.status === 200) {
            // Set response item to be returned
            item = JSON.parse(xhr.response);
            // Refresh local data object
            vcomet.StoreMemory.create(item, store);
            // Trigger user callback once data has been retrieved
            vcomet.triggerCallback("onCreateRemote", store, store, [item]);
            // Trigger onSourceChanged event
            vcomet.triggerCallback("onSourceChanged", store);
          }
        }
      };
      // Execute request with post payload data
      store.onLoaded(function(){xhr.send(JSON.stringify(item))});
    }
773169
public IStorer createStorer(SessionManagerConfig smc, IStore store) {
        IStorer storer = null;
        if (smc.getEnableTimeBasedWrite()) {
            storer = new TBWSessionStorer(store, 10); // 10 seconds is fixed - not configurable
        } else if (smc.getEnableManualWrite()) {
            storer = new ManualSessionStorer();
        } else {
            storer = new EOSSessionStorer();
        }
        return storer;
    }
18366
def _create_storer(self, group, format=None, value=None, append=False,
                       **kwargs):
        

        def error(t):
            raise TypeError(
                "cannot properly create the storer for: [{t}] [group->"
                "{group},value->{value},format->{format},append->{append},"
                "kwargs->{kwargs}]".format(t=t, group=group,
                                           value=type(value), format=format,
                                           append=append, kwargs=kwargs))

        pt = _ensure_decoded(getattr(group._v_attrs, 'pandas_type', None))
        tt = _ensure_decoded(getattr(group._v_attrs, 'table_type', None))

        # infer the pt from the passed value
        if pt is None:
            if value is None:

                _tables()
                if (getattr(group, 'table', None) or
                        isinstance(group, _table_mod.table.Table)):
                    pt = 'frame_table'
                    tt = 'generic_table'
                else:
                    raise TypeError(
                        "cannot create a storer if the object is not existing "
                        "nor a value are passed")
            else:

                try:
                    pt = _TYPE_MAP[type(value)]
                except KeyError:
                    error('_TYPE_MAP')

                # we are actually a table
                if format == 'table':
                    pt += '_table'

        # a storer node
        if 'table' not in pt:
            try:
                return globals()[_STORER_MAP[pt]](self, group, **kwargs)
            except KeyError:
                error('_STORER_MAP')

        # existing node (and must be a table)
        if tt is None:

            # if we are a writer, determine the tt
            if value is not None:

                if pt == 'series_table':
                    index = getattr(value, 'index', None)
                    if index is not None:
                        if index.nlevels == 1:
                            tt = 'appendable_series'
                        elif index.nlevels > 1:
                            tt = 'appendable_multiseries'
                elif pt == 'frame_table':
                    index = getattr(value, 'index', None)
                    if index is not None:
                        if index.nlevels == 1:
                            tt = 'appendable_frame'
                        elif index.nlevels > 1:
                            tt = 'appendable_multiframe'
                elif pt == 'wide_table':
                    tt = 'appendable_panel'
                elif pt == 'ndim_table':
                    tt = 'appendable_ndim'

            else:

                # distiguish between a frame/table
                tt = 'legacy_panel'
                try:
                    fields = group.table._v_attrs.fields
                    if len(fields) == 1 and fields[0] == 'value':
                        tt = 'legacy_frame'
                except IndexError:
                    pass

        try:
            return globals()[_TABLE_MAP[tt]](self, group, **kwargs)
        except KeyError:
            error('_TABLE_MAP')
229459
@Override
    public void createStoreIfAbsent(String storeName, boolean bBinaryValues) {
        String tableName = storeToTableName(storeName);
        if (!Tables.doesTableExist(m_ddbClient, tableName)) {
            // Create a table with a primary hash key named '_key', which holds a string
            m_logger.info("Creating table: {}", tableName);
            CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
                .withKeySchema(new KeySchemaElement()
                    .withAttributeName(ROW_KEY_ATTR_NAME)
                    .withKeyType(KeyType.HASH))
                .withAttributeDefinitions(new AttributeDefinition()
                    .withAttributeName(ROW_KEY_ATTR_NAME)
                    .withAttributeType(ScalarAttributeType.S))
                .withProvisionedThroughput(new ProvisionedThroughput()
                    .withReadCapacityUnits(READ_CAPACITY_UNITS)
                    .withWriteCapacityUnits(WRITE_CAPACITY_UNITS));
            m_ddbClient.createTable(createTableRequest).getTableDescription();
            try {
                Tables.awaitTableToBecomeActive(m_ddbClient, tableName);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);  
            }
        }
    }
613050
function makeSimpleStore(baseConnection) {
    baseConnection.constructor = makeSimpleStore;
    var behavior = Object.create(baseConnection);

    // this stores data like:
    // queries: {[queryKey]: {queryKey, query, recordIds}}
    // records
    return canReflect.assignMap(behavior, {
        getRecordFromParams: function(record) {
        	var id = canReflect.getIdentity(record, this.queryLogic.schema);
        	return this.getRecord(id);
        },

        log: function(){
			this._log = true;
		},

        getSets: function(){
			return this.getQueries();
		},
		getQueries: function(){
			return Promise.resolve(this.getQueriesSync());
		},
		getQueriesSync: function(){
			return this.getQueryDataSync().map(function(queryData){
				return queryData.query;
			});
		},

        getListData: function(query){
        	query = query || {};
        	var listData = this.getListDataSync(query);
        	if(listData) {
        		return Promise.resolve(listData);
        	}
        	return Promise.reject({
        		title: "no data",
        		status: "404",
        		detail: "No data available for this query.\nAvailable queries: "+
        			JSON.stringify(this.getQueriesSync())
        	});
        },
		getPaginatedListDataSync: function(superSetQueryData) {
			var records = this.getAllRecords();
			var queryWithoutPagination = this.queryLogic.removePagination(superSetQueryData.query);
			var matchingSuperRecordsNoPagination = this.queryLogic.filterMembersAndGetCount(queryWithoutPagination, {}, records);
			var startIndex = indexOf(matchingSuperRecordsNoPagination.data, superSetQueryData.startIdentity, this.queryLogic);
			var matchingSuperRecords = matchingSuperRecordsNoPagination.data.slice(startIndex, startIndex+ this.queryLogic.count(superSetQueryData.query));
			return {
				count: matchingSuperRecordsNoPagination.data.length,
				data: matchingSuperRecords
			};
		},
        getListDataSync: function(query){
			var queryData = this.getQueryDataSync(),
				superSetQueryData,
				isPaginated = this.queryLogic.isPaginated(query);

			for(var i = 0; i < queryData.length; i++) {
        		var checkSet = queryData[i].query;
        		if( this.queryLogic.isSubset(query, checkSet) ) {
					superSetQueryData = queryData[i];
        		}
        	}
			var records = this.getAllRecords();

			if(isPaginated && this.queryLogic.isPaginated(superSetQueryData.query) ) {
				var result = this.getPaginatedListDataSync(superSetQueryData);
				return this.queryLogic.filterMembersAndGetCount(query, superSetQueryData.query, result.data);
			}

            var matching = this.queryLogic.filterMembersAndGetCount(query, {}, records);
            if(matching && matching.count) {
                return matching;
            }
            // now check if we have a query  for it
        	if(superSetQueryData) {
				return {count: 0, data: []};
			}
        },

        updateListData: function(data, query){
			var queryData = this.getQueryDataSync();
        	query = query || {};
            var clonedData = canReflect.serialize(data);
        	var records = getItems(clonedData);
			// Update or create all records
			this.updateRecordsSync(records);
			var isPaginated = this.queryLogic.isPaginated(query);
			var identity = records.length ? canReflect.getIdentity(records[0],  this.queryLogic.schema) : undefined;
			if(isPaginated) {
				// we are going to merge with some paginated set
				for(var i = 0; i < queryData.length; i++) {
	        		var checkSet = queryData[i].query;
					var union = this.queryLogic.union(checkSet, query);
					if( this.queryLogic.isDefinedAndHasMembers(union)  ) {
						var siblingRecords = this.getPaginatedListDataSync(queryData[i]);
						var res = this.queryLogic.unionMembers(checkSet, query, siblingRecords.data, records );
						identity = canReflect.getIdentity(res[0],  this.queryLogic.schema);
						queryData[i] = {
							query: union,
							startIdentity: identity
						};
						this.updateQueryDataSync(queryData);
						return Promise.resolve();
					}
	        	}

				queryData.push({
					query: query,
					startIdentity: identity
				});
				this.updateQueryDataSync(queryData);
				return Promise.resolve();
			}

            // we need to remove everything that would have matched this query before, but that's not in data
            // but what if it's in another set -> we remove it
            var allRecords = this.getAllRecords();
            var curretMatching = this.queryLogic.filterMembers(query, allRecords);
            if(curretMatching.length) {
                var toBeDeleted = new Map();
                curretMatching.forEach(function(record){
                    toBeDeleted.set( canReflect.getIdentity(record, this.queryLogic.schema), record );
                }, this);

                // remove what's in records
                records.forEach(function(record){
                    toBeDeleted.delete( canReflect.getIdentity(record, this.queryLogic.schema) );
                }, this);

                this.destroyRecords( canReflect.toArray(toBeDeleted) );
            }

            // the queries that are not consumed by query
            var allQueries = this.getQueryDataSync();
            var notSubsets = allQueries.filter(function(existingQueryData){
                    return !this.queryLogic.isSubset(existingQueryData.query, query);
                }, this),
                superSets = notSubsets.filter(function(existingQueryData){
                    return this.queryLogic.isSubset(query, existingQueryData.query);
                }, this);

			// would need to note the first record ... so we can do a query w/o pagination
			//

            // if there are sets that are parents of query
            if(superSets.length) {
                this.updateQueryDataSync(notSubsets);
            } else {
                this.updateQueryDataSync(notSubsets.concat([{
					query: query,
					startIdentity:identity
				}]));
            }

        	// setData.push({query: query, items: data});
        	return Promise.resolve();
        },

        getData: function(params){
        	var id = canReflect.getIdentity(params, canReflect.getSchema( this.queryLogic ) );
        	var res = this.getRecord(id);
        	if(res){
        		return Promise.resolve( res );
        	} else {
        		return Promise.reject({
        			title: "no data",
        			status: "404",
        			detail: "No record with matching identity ("+id+")."
        		});
        	}
        },
        createData: function(record){
			this.updateRecordsSync([record]);

			return Promise.resolve(canReflect.assignMap({}, this.getRecordFromParams(record) ));
		},

		updateData: function(record){

			if(this.errorOnMissingRecord && !this.getRecordFromParams(record)) {
				var id = canReflect.getIdentity(record, this.queryLogic.schema);
				return Promise.reject({
					title: "no data",
					status: "404",
					detail: "No record with matching identity ("+id+")."
				});
			}

			this.updateRecordsSync([record]);

			return Promise.resolve(canReflect.assignMap({},this.getRecordFromParams(record) ));
		},

		destroyData: function(record){
			var id = canReflect.getIdentity(record,  this.queryLogic.schema),
				savedRecord = this.getRecordFromParams(record);

			if(this.errorOnMissingRecord && !savedRecord) {

				return Promise.reject({
					title: "no data",
					status: "404",
					detail: "No record with matching identity ("+id+")."
				});
			}
            this.destroyRecords([record]);
			return Promise.resolve(canReflect.assignMap({},savedRecord || record));
		}
    });
}
337221
function(v, storeT, storeL) {
  this.platform = util.format('%s-%s%s', os.arch(), os.platform(), os.release());
  this.options = {
    method: 'GET',
    uri: '',
    json: true,
    resolveWithFullResponse: true,
    gzip: true,
    headers: {
      'Authorization': '',
      'User-Agent': util.format('MySportsFeeds-Node/%s (%s)', libVersion, this.platform)
    },
    qs: {},
    transform: function(body) {
      // console.log("response = '" + util.inspect(body, {depth: null}) + "'");

      return body;
    }
  };
  this.auth = null;
  this.baseUrl = null;

  this.verbose = v;
  this.storeType = storeT;
  this.storeLocation = storeL;
  this.baseUrl = "https://api.mysportsfeeds.com/v1.0/pull";

  this.validFeeds = [
      'cumulative_player_stats',
      'full_game_schedule',
      'daily_game_schedule',
      'daily_player_stats',
      'game_boxscore',
      'scoreboard',
      'game_playbyplay',
      'player_gamelogs',
      'team_gamelogs',
      'roster_players',
      'game_startinglineup',
      'active_players',
      'overall_team_standings',
      'conference_team_standings',
      'division_team_standings',
      'playoff_team_standings',
      'player_injuries',
      'daily_dfs',
      'current_season',
      'latest_updates'
  ];
}
915251
function setupStore() {
	store = new Store();


	mmrpNode.on('delivery.msgServer.connect', function (envelope) {
		if (store && !envelope.routeRemains() && envelope.hasReturnRoute()) {
			var address = String(envelope.messages[0]);
			var disconnects = String(envelope.messages[1]);

			store.connectAddress(envelope.returnRoute, address, disconnects);

			store.forward(address, function (error) {
				if (error) {
					informHostGone(envelope.returnRoute, address);
				}
			});
		}
	});

	mmrpNode.on('delivery.msgServer.disconnect', function (envelope) {
		if (store) {
			store.disconnectAddress(String(envelope.messages[0]));
		}
	});

	mmrpNode.on('delivery.msgServer.confirm', function (envelope) {
		if (store && !envelope.routeRemains()) {
			// this is for us

			var payload = JSON.parse(envelope.messages[0]);

			store.confirm(payload.address, payload.msgIds);
		}
	});

	mmrpNode.on('delivery.msgServer.send', function (envelope) {
		var address = String(envelope.messages[0]);

		if (store && store.managesAddress(address)) {
			logger.verbose('Sending envelope messages into store for address', address);

			store.send(address, envelope.messages.slice(1));

			store.forward(address, function (error) {
				if (error && envelope.hasReturnRoute()) {
					informHostGone(envelope.returnRoute, address);
				}
			});

			if (envelope.routeRemains()) {
				logger.warning('Message store was the endpoint, yet route remains:', envelope.route);
				envelope.consumeRoute();
			}
		} else {
			logger.verbose('Envelope passing by for address', address, '(not hosted here)');
		}
	});

	mmrpNode.on('delivery.msgServer.broadcast', function (envelope) {
		function quietLog(error) {
			if (error) {
				logger.verbose(error);
			}
		}

		if (store) {
			var addresses = store.getAddresses();

			for (var i = 0, len = addresses.length; i < len; i += 1) {
				var address = addresses[i];

				store.send(address, envelope.messages);
				store.forward(address, quietLog);
			}
		}
	});

	store.setForwarder(function (messages, address, route, cb) {
		if (mmrpNode) {
			mmrpNode.send(new Envelope('msgServer.messagepack', [address].concat(messages), route), null, cb);
		} else {
			if (cb) {
				cb();
			}
		}
	});
}
805038
public void extendStore( int blockSize , int oldBlockCount , int newBlockCount ) throws JournalException
    {
        // Refuse any further operation in case of previous failure
        if (failing)
            throw new JournalException("Store journal is failing");
        
        synchronized (journalWriteQueue)
        {
            if (traceEnabled)
                log.trace("["+baseName+"] #"+currentTransactionId+" Queueing store extend : blockSize="+blockSize+" blockCount="+oldBlockCount+" -> "+newBlockCount+" / queueSize="+(journalWriteQueue.size()+1));
            
            StoreExtendOperation op = new StoreExtendOperation(currentTransactionId,blockSize,oldBlockCount,newBlockCount);

            unflushedJournalSize += op.size();
            journalWriteQueue.addLast(op);
            totalPendingOperations++;
        }
    }
359965
def create_store():
    
    new_storage = _proxy('store')
    _state.store = type('store', (object,), {})
    new_storage.store = dict()
    return new_storage.store
540675
public void addSpace(String spaceID, Map<String, AclType> userACLs, String storeID)
        throws ResourceException, InvalidIdException {
        IdUtil.validateSpaceId(spaceID);

        try {
            StorageProvider storage = storageProviderFactory.getStorageProvider(storeID);
            storage.createSpace(spaceID);

            waitForSpaceCreation(storage, spaceID);
            updateSpaceACLs(spaceID, userACLs, storeID);
        } catch (NotFoundException e) {
            throw new InvalidIdException(e.getMessage());
        } catch (Exception e) {
            storageProviderFactory.expireStorageProvider(storeID);
            throw new ResourceException("add space", spaceID, e);
        }
    }
585322
public static DataStore create(Map<String, Object> parameters) throws IOException {
		Object url = parameters.get(ShapefileDataStoreFactory.URLP.key);
		Logger log = LoggerFactory.getLogger(DataStoreFactory.class);
		if (url instanceof String) {
			parameters.put(ShapefileDataStoreFactory.URLP.key, ResourceUtils.getURL((String) url).toExternalForm());
		}
		if (DATASTORE_CACHE.containsKey(parameters)) {
			return DATASTORE_CACHE.get(parameters);
		}
		DataStore store = DataStoreFinder.getDataStore(parameters);
		Object typed = parameters.get(USE_TYPED_FIDS);
		if (typed instanceof String) {
			Boolean t = Boolean.valueOf((String) typed);
			if (!t) {
				if (store != null) {
					log.warn("Non-typed FIDs are only supported by first-generation JDBC datastores, "
							+ "using default fid format for datastore class " + store.getClass().getName());
				}
			}
		}
		if (null == store) {
			StringBuilder availableStr = new StringBuilder();
			StringBuilder missingStr = new StringBuilder();
			Iterator<DataStoreFactorySpi> all = DataStoreFinder.getAllDataStores();
			while (all.hasNext()) {
				DataStoreFactorySpi factory = all.next();
				if (!factory.isAvailable()) {
					log.warn("Datastore factory " + factory.getDisplayName() + "(" + factory.getDescription()
							+ ") is not available");
					if (missingStr.length() != 0) {
						missingStr.append(",");
					}
					missingStr.append(factory.getDisplayName());
				} else {
					if (availableStr.length() != 0) {
						availableStr.append(",");
					}
					availableStr.append(factory.getDisplayName());
				}
			}
			throw new IOException(
					"No datastore found. Possible causes are missing factory or missing library for your datastore"
							+ " (e.g. database driver).\nCheck the isAvailable() method of your"
							+ " DataStoreFactory class to find out which libraries are needed.\n"
							+ "Unavailable factories : " + missingStr + "\n" + "Available factories : " + availableStr
							+ "\n");
		}
		DATASTORE_CACHE.put(parameters, store);
		return store;
	}
1099367
func main() {
	data := map[string]int{}

	for i := 0; i < 100; i++ {
		err := retro.DoWithRetry(func() error {
			return storeInt(data, i)
		})
		if err != nil {
			fmt.Printf("FATAL: Failed to store %d: %s\n", i, err.Error())
			os.Exit(1)
		}
	}

}
1356115
function InMemoryStorage() {

	var store = {};
    var self = this;

	this.getItem = function(key) {
		return store[key] || null;
	};

	this.setItem = function(key, value) {
		store[key] = value;
        updateLength();
	};

	this.removeItem = function(key) {
		delete store[key];
        updateLength();
	};

	this.clear = function() {
		store = {};
        updateLength();
	};

    function updateLength() {
        self.length = Object.keys(store).length
    }

    updateLength();
}
1095073
func (fs *FileStore) CreateChannel(channel string) (*Channel, error) {
	fs.Lock()
	defer fs.Unlock()

	// Verify that it does not already exist or that we did not hit the limits
	if err := fs.canAddChannel(channel); err != nil {
		return nil, err
	}

	// We create the channel here...

	channelDirName := filepath.Join(fs.fm.rootDir, channel)
	if err := os.MkdirAll(channelDirName, os.ModeDir+os.ModePerm); err != nil {
		return nil, err
	}

	var err error
	var msgStore MsgStore
	var subStore SubStore

	channelLimits := fs.genericStore.getChannelLimits(channel)

	msgStore, err = fs.newFileMsgStore(channelDirName, channel, &channelLimits.MsgStoreLimits, false)
	if err != nil {
		return nil, err
	}
	subStore, err = fs.newFileSubStore(channel, &channelLimits.SubStoreLimits, false)
	if err != nil {
		msgStore.Close()
		return nil, err
	}

	c := &Channel{
		Subs: subStore,
		Msgs: msgStore,
	}

	fs.channels[channel] = c

	return c, nil
}
776520
func (p *partitions) createChannelsMapAndSublist(storeChannels map[string]*stores.ChannelLimits) {
	p.channels = make([]string, 0, len(storeChannels))
	p.sl = util.NewSublist()
	for c := range storeChannels {
		p.channels = append(p.channels, c)
		// When creating the store, we have already checked that channel names
		// were valid. So this call cannot fail.
		p.sl.Insert(c, channelInterest)
	}
}