public static long[] GetNextSequences(this ISequenceSource seq, DynamoMetadataType meta, int noOfSequences) { var newCounter = seq.Increment(meta, noOfSequences); var firstId = newCounter - noOfSequences + 1; var ids = new long[noOfSequences]; for (var i = 0; i < noOfSequences; i++) { ids[i] = firstId + i; } return(ids); }
private Task CreateTableAsync(DynamoMetadataType table) { var request = ToCreateTableRequest(table); try { return ExecAsync(() => DynamoDb.CreateTableAsync(request)); } catch (AmazonDynamoDBException ex) { if (ex.ErrorCode == DynamoErrors.AlreadyExists) return PclExportClient.EmptyTask; throw; } }
public static long Increment(this ISequenceSource seq, DynamoMetadataType meta, int amount = 1) { return(seq.Increment(meta.Name, amount)); }
public static long Current(this ISequenceSource seq, DynamoMetadataType meta) { return(seq.Increment(meta.Name, 0)); }
public DynamoDbSequenceSource(IPocoDynamo db) { this.db = db; this.table = DynamoMetadata.RegisterTable <Seq>(); }