burrow stream event

StreamEvent

StreamEvent is used to mark the border of data stream when get blocks via grpc stream.

type StreamEvent struct {
	BeginBlock           *BeginBlock                                 `protobuf:"bytes,1,opt,name=BeginBlock,proto3" json:"BeginBlock,omitempty"`
	BeginTx              *BeginTx                                    `protobuf:"bytes,2,opt,name=BeginTx,proto3" json:"BeginTx,omitempty"`
	Envelope             *github_com_hyperledger_burrow_txs.Envelope `protobuf:"bytes,3,opt,name=Envelope,proto3,customtype=github.com/hyperledger/burrow/txs.Envelope" json:"Envelope,omitempty"`
	Event                *Event                                      `protobuf:"bytes,4,opt,name=Event,proto3" json:"Event,omitempty"`
	EndTx                *EndTx                                      `protobuf:"bytes,5,opt,name=EndTx,proto3" json:"EndTx,omitempty"`
	EndBlock             *EndBlock                                   `protobuf:"bytes,6,opt,name=EndBlock,proto3" json:"EndBlock,omitempty"`
}

We can assembly them to BlockExecutions and TxExecutions.

// Consume will add the StreamEvent passed to the block accumulator and if the block complete is complete return the
// BlockExecution, otherwise will return nil
func (ba *BlockAccumulator) Consume(ev *StreamEvent) (*BlockExecution, error) {
	switch {
	case ev.BeginBlock != nil:
		ba.block = &BlockExecution{
			Height: ev.BeginBlock.Height,
			Header: ev.BeginBlock.Header,
			Hash:   ev.BeginBlock.Hash,
		}
	case ev.BeginTx != nil, ev.Envelope != nil, ev.Event != nil, ev.EndTx != nil:
		txe, err := ba.stack.Consume(ev)
		if err != nil {
			return nil, err
		}
		if txe != nil {
			ba.block.TxExecutions = append(ba.block.TxExecutions, txe)
		}
	case ev.EndBlock != nil:
		return ba.block, nil
	}
	return nil, nil
}

// Consume will add the StreamEvent to the transaction stack and if that completes a single outermost transaction
// returns the TxExecution otherwise will return nil
func (stack *TxStack) Consume(ev *StreamEvent) (*TxExecution, error) {
	switch {
	case ev.BeginTx != nil:
		stack.Push(initTx(ev.BeginTx))
	case ev.Envelope != nil:
		txe, err := stack.Peek()
		if err != nil {
			return nil, err
		}
		txe.Envelope = ev.Envelope
		txe.Receipt = txe.Envelope.Tx.GenerateReceipt()
	case ev.Event != nil:
		txe, err := stack.Peek()
		if err != nil {
			return nil, err
		}
		txe.Events = append(txe.Events, ev.Event)
	case ev.EndTx != nil:
		txe, err := stack.Pop()
		if err != nil {
			return nil, err
		}
		if len(*stack) == 0 {
			// This terminates the outermost transaction
			return txe, nil
		}
		// If there is a parent tx on the stack add this tx as child
		parent, err := stack.Peek()
		if err != nil {
			return nil, err
		}
		parent.TxExecutions = append(parent.TxExecutions, txe)
	}
	return nil, nil
}

BeginBlock

type BeginBlock struct {
	// The height of this block
	Height               uint64        `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"`
	Header               *types.Header `protobuf:"bytes,2,opt,name=Header,proto3" json:"Header,omitempty"`
	Hash                 []byte        `protobuf:"bytes,3,opt,name=Hash,proto3" json:"Hash,omitempty"`
}

BeginTx

type BeginTx struct {
	TxHeader *TxHeader `protobuf:"bytes,1,opt,name=TxHeader,proto3" json:"TxHeader,omitempty"`
	// Result of tx execution
	Result *Result `protobuf:"bytes,2,opt,name=Result,proto3" json:"Result,omitempty"`
	// If tx execution was an exception
	Exception            *errors.Exception `protobuf:"bytes,4,opt,name=Exception,proto3" json:"Exception,omitempty"`
}

Envelope

// An envelope contains both the signable Tx and the signatures for each input (in signatories)
type Envelope struct {
	Signatories []Signatory `protobuf:"bytes,1,rep,name=Signatories,proto3" json:"Signatories"`
	// Canonical bytes of the Tx ready to be signed
	Tx                   *Tx               `protobuf:"bytes,2,opt,name=Tx,proto3,customtype=Tx" json:"Tx,omitempty"`
	Enc                  Envelope_Encoding `protobuf:"varint,3,opt,name=Enc,proto3,enum=txs.Envelope_Encoding" json:"Enc,omitempty"`
}

Event

We will disccuss it in burrow event

type Event struct {
	Header               *Header             `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"`
	Input                *InputEvent         `protobuf:"bytes,2,opt,name=Input,proto3" json:"Input,omitempty"`
	Output               *OutputEvent        `protobuf:"bytes,3,opt,name=Output,proto3" json:"Output,omitempty"`
	Call                 *CallEvent          `protobuf:"bytes,4,opt,name=Call,proto3" json:"Call,omitempty"`
	Log                  *LogEvent           `protobuf:"bytes,5,opt,name=Log,proto3" json:"Log,omitempty"`
	GovernAccount        *GovernAccountEvent `protobuf:"bytes,6,opt,name=GovernAccount,proto3" json:"GovernAccount,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

EndTx

type EndTx struct {
	// The hash of the transaction that caused this event to be generated
	TxHash               github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,3,opt,name=TxHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"TxHash"`
}

EndBlock

type EndBlock struct {
	Height               uint64   `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"`
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面只是目标目录 ├─第1章-Shiro权限实战课程介绍 │ 1-1Shiro权限实战课程介绍.mp4 │ 1-2权限控制和初学JavaWeb处理访问权限控制.mp4 │ ├─第2章-大话权限框架核心知识ACL和RBAC │ 2-1权限框架设计之ACL和RBAC讲解.mp4 │ 2-2主流权限框架介绍和技术选型讲解.mp4 │ ├─第3章-ApacheShiro基础概念知识和架构讲解 │ 3-1Shiro核心知识之架构图交互和四大模块讲解.mp4 │ 3-2用户访问Shrio权限控制运行流程和常见概念讲解.mp4 │ ├─第4章-Springboot2.x整合ApacheShiro快速上手实战 │ 4-1SpringBoot2.x整合Shiro.mp4 │ 4-2快速上手之Shiro认证和授权流程实操上集.mp4 │ 4-3Shiro认证和授权流程和常用API梳理下集.mp4 │ ├─第5章-详细讲解ApacheShirorealm实战 │ 5-1Shiro安全数据来源之Realm讲解.mp4 │ 5-2快速上手之Shiro内置IniRealm实操.mp4 │ 5-3快速上手之Shiro内置JdbcRealm实操.mp4 │ 5-4ApacheShiro自定义Readl实战.mp4 │ 5-5深入Shiro源码解读认证授权流程.mp4 │ ├─第6章-Shiro权限认证Web案例知识点讲解 │ 6-1Shiro内置的Filter过滤器讲解.mp4 │ 6-2Shiro的Filter配置路径讲解.mp4 │ 6-3Shiro数据安全之数据加解密.mp4 │ 6-4Shiro权限控制注解和编程方式讲解.mp4 │ 6-5Shiro缓存模块讲解.mp4 │ 6-6ShiroSession模块讲解.mp4 │ ├─第7章-ApacheShiro整合SpringBoot2.x综合案例实战 │ 7-10使用ShiroLogout和加密处理.mp4 │ 7-1Shiro整合SpringBoot2.x案例实战介绍.mp4 │ 7-2基于RBAC权限控制实战之Mysql数据库设计.mp4 │ 7-3SpringBoot2.x项目框架和依赖搭建.mp4 │ 7-4案例实战之权限相关服务接口开发.mp4 │ 7-5案例实战之用户角色权限多对多关联查询SQL.mp4 │ 7-6案例实战自定义CustomRealm实战.mp4 │ 7-7项目实战之ShiroFilterFactoryBean配置实战.mp4 │ 7-8前后端分离自定义SessionManager验证.mp4 │ 7-9API权限拦截验证实战.mp4 │ ├─第8章-权限控制综合案例实战进阶 │ 8-1实战进阶之自定义ShiroFilter过滤器上集.mp4 │ 8-2实战进阶之自定义ShiroFilter过滤器下集.mp4 │ 8-3性能提升之Redis整合CacheManager.mp4 │ 8-4性能提升之Redis整合SessionManager.mp4 │ 8-5ShiroConfig常用bean类配置.mp4 │ ├─第9章-大话分布式应用的鉴权方式 │ 9-1单体应用到分布式应用下的鉴权方式介绍.mp4 │ 9-2Shiro整合SpringBoot下自定义SessionId.mp4 │ ├─第10章-Shiro课程总结 │ 10-1Apacheshiro从入门到高级实战课程总结.mp4 │ 10-2高级工程师到架构师-解决问题思路+学习方法.mp4 │ └─课件资料.zip
1444. Elephpotamus Time limit: 0.5 second Memory limit: 64 MB Harry Potter is taking an examination in Care for Magical Creatures. His task is to feed a dwarf elephpotamus. Harry remembers that elephpotamuses are very straightforward and imperturbable. In fact, they are so straightforward that always move along a straight line and they are so imperturbable that only move when attracted by something really tasty. In addition, if an elephpotamus stumbles into a chain of its own footprints, it falls into a stupor and refuses to go anywhere. According to Hagrid, elephpotamuses usually get back home moving along their footprints. This is why they never cross them, otherwise they may get lost. When an elephpotamus sees its footprints, it tries to remember in detail all its movements since leaving home (this is also the reason why they move along straight lines only, this way it is easier to memorize). Basing on this information, the animal calculates in which direction its burrow is situated, then turns and goes straight to it. It takes some (rather large) time for an elephpotamus to perform these calculations. And what some ignoramuses recognize as a stupor is in fact a demonstration of outstanding calculating abilities of this wonderful, though a bit slow-witted creature. Elephpotamuses' favorite dainty is elephant pumpkins, and some of such pumpkins grow on the lawn where Harry is to take his exam. At the start of the exam, Hagrid will drag the elephpotamus to one of the pumpkins. Having fed the animal with a pumpkin, Harry can direct it to any of the remaining pumpkins. In order to pass the exam, Harry must lead the elephpotamus so that it eats as many pumpkins as possible before it comes across its footprints. Input The first input line contains the number of pumpkins on the lawn N (3 ≤ N ≤ 30000). The pumpkins are numbered from 1 to N, the number one being assigned to the pumpkin to which the animal is brought at the start of the trial. In the next N lines, the coordinates of the pumpkins are given in the order corresponding to their numbers. All the coordinates are integers in the range from −1000 to 1000. It is guaranteed that there are no two pumpkins at the same location and there is no straight line passing through all the pumpkins. Output In the first line write the maximal number K of pumpkins that can be fed to the elephpotamus. In the next K lines, output the order in which the animal will eat them, giving one number in a line. The first number in this sequence must always be 1.写一段Java完成此目的
06-03

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值