예제 #1
0
파일: Data.cs 프로젝트: lulzzz/OSP
        public DateTime GetTime(TimePolicy policy)
        {
            DateTime time;

            switch (policy)
            {
            case TimePolicy.EventTime:
                var prop  = this.Value.GetType().GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(EventTime))).FirstOrDefault();
                var value = prop.GetValue(Value, null);
                if (value == null)
                {
                    throw new FieldAccessException("Data type does not contain event time");
                }
                time = (DateTime)value;
                break;

            case TimePolicy.ProcessingTime:
                time = TimeStamp;
                break;

            default:
                throw new ArgumentException("Such Time policy not suported");
            }
            return(time);
        }
예제 #2
0
파일: Source.cs 프로젝트: lulzzz/OSP
        public async Task InitSource(TimePolicy policy)
        {
            Policy = policy;
            if ((NextStreamIds.Count == 0 || NextStreamGuid == null))
            {
                var result = await GrainFactory.GetGrain <IJob>(JobMgrId, JobMgrType.FullName).GetOutputStreams(this.GetPrimaryKey(), GetType());

                if (result.HasValue)
                {
                    NextStreamGuid = result.Value.Item1;
                    NextStreamIds  = result.Value.Item2;
                    _partitioner.SetOutputStreams(NextStreamGuid, NextStreamIds);
                }
                else
                {
                    throw new ArgumentNullException("No next operator found, check topology");
                }
                // Need to keep null types in case of sink,
            }
        }