Exemplo n.º 1
0
Arquivo: Data.cs Projeto: 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);
        }
Exemplo n.º 2
0
Arquivo: Source.cs Projeto: 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,
            }
        }