// CreateBlockWithCCEvent creates a mock block
512823
func CreateBlockWithCCEvent(events *pp.ChaincodeEvent, txID string,
	channelID string) (*common.Block, error) {
	return CreateBlockWithCCEventAndTxStatus(events, txID, channelID, pp.TxValidationCode_VALID)
}
1235859
func NewBlockData(height uint64) *BlockData {
	data := types.EventData{
		Tables:      make(map[string]types.EventDataTable),
		BlockHeight: height,
	}

	return &BlockData{
		Data: data,
	}
}
1255148
func WithEventHandler(handler events.Handler) Option {
	return func(c *Config) Option {
		old := c.handler
		c.handler = handler
		return WithEventHandler(old)
	}
}
841513
func (w *Webhook) HasCreateEvent() bool {
	return w.SendEverything ||
		(w.ChooseEvents && w.HookEvents.Create)
}
772621
func createEvent(action string) *Event {
	return &Event{
		ID:        uuid.Generate().String(),
		Timestamp: time.Now(),
		Action:    action,
	}
}
904099
func CreateEventData(eventType EventType) (EventData, error) {
	eventDataFactoriesMu.RLock()
	defer eventDataFactoriesMu.RUnlock()
	if factory, ok := eventDataFactories[eventType]; ok {
		return factory(), nil
	}
	return nil, ErrEventDataNotRegistered
}
1237435
func (bw *BlockWriter) CreateNextBlock(messages []*cb.Envelope) *cb.Block {
	previousBlockHash := bw.lastBlock.Header.Hash()

	data := &cb.BlockData{
		Data: make([][]byte, len(messages)),
	}

	var err error
	for i, msg := range messages {
		data.Data[i], err = proto.Marshal(msg)
		if err != nil {
			logger.Panicf("Could not marshal envelope: %s", err)
		}
	}

	block := cb.NewBlock(bw.lastBlock.Header.Number+1, previousBlockHash)
	block.Header.DataHash = data.Hash()
	block.Data = data

	return block
}
1291536
func (c *Client) NewEvent() *Event {
	c.ensureTransmission()
	c.ensureBuilder()
	return c.builder.NewEvent()
}
947367
func (remote *RemoteDebugger) CallbackEvent(method string, cb EventCallback) {
	remote.Lock()
	remote.callbacks[method] = cb
	remote.Unlock()
}
267800
func NewContextBlock(blockID string, elements ...BlockObject) *ContextBlock {
	return &ContextBlock{
		Type:     mbtContext,
		BlockID:  blockID,
		Elements: elements,
	}
}
1320663
func (m *MockEventService) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error) {
	eventCh := make(chan *fab.FilteredBlockEvent)
	reg := &dispatcher.FilteredBlockReg{
		Eventch: eventCh,
	}
	return reg, eventCh, nil
}
904901
func (c *Client) CreateBlockStorage(name string, regionID, size int) (BlockStorage, error) {
	values := url.Values{
		"label":   {name},
		"DCID":    {fmt.Sprintf("%v", regionID)},
		"size_gb": {fmt.Sprintf("%v", size)},
	}

	var storage BlockStorage
	if err := c.post(`block/create`, values, &storage); err != nil {
		return BlockStorage{}, err
	}
	storage.RegionID = regionID
	storage.Name = name
	storage.SizeGB = size

	return storage, nil
}
230154
func (w *Writer) writeBlock() {
	_, w.err = w.w.Write(w.buf[w.written:])
	w.i = 0
	w.j = headerSize
	w.written = 0
}
1243318
func (self *events) AddEvent(e *Event) error {
	self.updateEventStore(e)
	self.watcherLock.RLock()
	defer self.watcherLock.RUnlock()
	watchesToSend := self.findValidWatchers(e)
	for _, watchObject := range watchesToSend {
		watchObject.eventChannel.GetChannel() <- e
	}
	log.Infof("WRIT %s %s", e.EventType, e.EventAction.String())
	return nil
}
18745
func NewEvent(title, text string) *Event {
	return &Event{
		Title: title,
		Text:  text,
	}
}
213626
func NewMockLedger(eventFactory EventFactory, sourceURL string) *MockLedger {
	return &MockLedger{
		eventFactory:  eventFactory,
		blockProducer: NewBlockProducer(),
		sourceURL:     sourceURL,
	}
}
305641
func (c *events) Create(event *api.Event) (result *api.Event, err error) {
	result = &api.Event{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("events").
		Body(event).
		Do().
		Into(result)
	return
}