コード例 #1
0
 public void Log(string message, RecordKind kindOfRecord)
 {
     OnLog?.Invoke(null, new LogEntry()
     {
         LogMessage = message, RecordKind = kindOfRecord
     });
 }
コード例 #2
0
        public Article GetArticle(Article article, RecordKind kind = RecordKind.UPTODATE)
        {
            if (kind == RecordKind.UPTODATE)
            {
                article.VDepth = 0;
            }
            else if (kind == RecordKind.OLDEST)
            {
                // depth >= 0
                SetMostOldVersion(article);
            }
            else if (kind == RecordKind.DEFINED)
            {
                // TODO code for defined case
            }

            var fetched = FetchArticle(article);


            if (fetched == null)
            {
                DbEx.Instance.Throw <NoArticleFoundException>(article);
            }

            Wrapper.React.SetTop3ReactionCounts(fetched);
            return(fetched);
        }
コード例 #3
0
        public Comment GetComment(Comment comment, RecordKind kind = RecordKind.UPTODATE)
        {
            if (kind == RecordKind.UPTODATE)
            {
                comment.RDepth = 0;
            }
            else if (kind == RecordKind.OLDEST)
            {
                // depth >= 0
                SetMostOldVersion(comment);
            }
            else if (kind == RecordKind.DEFINED)
            {
                // TODO code for defined case
            }

            var fetched = FindByCondition(c =>
                                          c.Id.Equals(comment.Id) &&
                                          c.RDepth.Equals(comment.RDepth)
                                          )
                          .FirstOrDefault();

            if (fetched == null)
            {
                DbEx.Instance.Throw <NoCommentFoundException>(comment);
            }

            Wrapper.React.SetTop3ReactionCounts(fetched);
            return(fetched);
        }
コード例 #4
0
ファイル: EventRecord.cs プロジェクト: okproject/ses
 private EventRecord(string contractName, int version, byte[] payload, RecordKind kind)
 {
     ContractName = contractName;
     Version      = version;
     Payload      = payload;
     Kind         = kind;
 }
コード例 #5
0
 public GetWalkSequenceRecordPages(string jobId, RecordKind kind)
 {
     ServicePath       = $"{WalkSequenceClient.BASE_PATH}/v1/jobs/{jobId}/records/pages";
     QueryStringParams = new Dictionary <string, string>
     {
         { "kind", kind.ToString() }
     };
 }
コード例 #6
0
 public GetUsMoveUpdateRecordPages(string jobId, RecordKind kind)
 {
     ServicePath       = $"services/us-move-update/v1/jobs/{jobId}/records/pages";
     QueryStringParams = new Dictionary <string, string>
     {
         { "kind", kind.ToString() }
     };
 }
コード例 #7
0
        public void IncrementInvalidCountForAssert(RecordKind recordKind)
        {
#if DEBUG
            // DeletedVersion is not invalidated
            if (recordKind != RecordKind.DeletedVersion)
            {
                this.numInvalidKeysForAssert++;
            }
#endif
        }
コード例 #8
0
        private string GetFormattedLogText(string message, RecordKind kindOfRecord)
        {
            string value = kindOfRecord switch
            {
                RecordKind.CommandReceived => "Received a command",
                RecordKind.Error => "Error",
                RecordKind.Status => "Status",
                _ => "Status"
            };

            return($"{DateTime.Now.ToString()} : {value} : {message} {Environment.NewLine}");
        }
    }
コード例 #9
0
        public void Log(string message, RecordKind kindOfRecord)
        {
            if (!_isLoggingEnabled)
            {
                return;
            }

            var fullLogFilePath = DefaultServerValues.LoggingPath + Path.DirectorySeparatorChar + loggingFile;

            lock (padLock)
            {
                using (StreamWriter sWriter = new StreamWriter(fullLogFilePath, true))
                {
                    sWriter.Write(GetFormattedLogText(message, kindOfRecord));
                }
            }
        }
コード例 #10
0
 public new void Log(string message, RecordKind kindOfRecord)
 {
     base.Log(message, kindOfRecord);
 }
コード例 #11
0
 public TWriteSetItemContext(TWriteSetItemContext previous, TVersionedItem <TValue> latestValue)
 {
     this.LatestValue          = latestValue;
     this.CreateSequenceNumber = previous.CreateSequenceNumber;
     this.FirstVersionKind     = previous.FirstVersionKind;
 }
コード例 #12
0
 public TWriteSetItemContext(TVersionedItem <TValue> value)
 {
     this.LatestValue          = value;
     this.CreateSequenceNumber = value.VersionSequenceNumber;
     this.FirstVersionKind     = value.Kind;
 }