本文整理匯總了Golang中github.com/FactomProject/factomd/common/interfaces.IHash.Fixed方法的典型用法代碼示例。如果您正苦於以下問題:Golang IHash.Fixed方法的具體用法?Golang IHash.Fixed怎麽用?Golang IHash.Fixed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/common/interfaces.IHash
的用法示例。
在下文中一共展示了IHash.Fixed方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PutCommit
func (s *State) PutCommit(hash interfaces.IHash, msg interfaces.IMsg) {
cs := s.Commits[hash.Fixed()]
if cs == nil {
cs = make([]interfaces.IMsg, 0)
}
s.Commits[hash.Fixed()] = append(cs, msg)
}
示例2: NextCommit
// Returns the oldest, not processed, Commit received
func (s *State) NextCommit(hash interfaces.IHash) interfaces.IMsg {
cs := s.Commits[hash.Fixed()]
if cs == nil {
return nil
}
if len(cs) == 0 {
delete(s.Commits, hash.Fixed())
return nil
}
r := cs[0]
copy(cs[:], cs[1:])
cs[len(cs)-1] = nil
s.Commits[hash.Fixed()] = cs[:len(cs)-1]
return r
}
示例3: IsTSValid
// Checks if the timestamp is valid. If the timestamp is too old or
// too far into the future, then we don't consider it valid. Or if we
// have seen this hash before, then it is not valid. To that end,
// this code remembers hashes tested in the past, and rejects the
// second submission of the same hash.
func (r *Replay) IsTSValid(mask int, hash interfaces.IHash, timestamp interfaces.Timestamp) bool {
return r.IsTSValid_(mask, hash.Fixed(), timestamp, primitives.NewTimestampNow())
}
示例4: AddNewEntry
func (p *ProcessList) AddNewEntry(key interfaces.IHash, value interfaces.IEntry) {
p.NewEntriesMutex.Lock()
defer p.NewEntriesMutex.Unlock()
p.NewEntries[key.Fixed()] = value
}
示例5: DeleteNewEntry
func (p *ProcessList) DeleteNewEntry(key interfaces.IHash) {
p.NewEntriesMutex.Lock()
defer p.NewEntriesMutex.Unlock()
delete(p.NewEntries, key.Fixed())
}
示例6: DeleteEBlocks
func (p *ProcessList) DeleteEBlocks(key interfaces.IHash) {
p.neweblockslock.Lock()
defer p.neweblockslock.Unlock()
delete(p.NewEBlocks, key.Fixed())
}
示例7: GetNewEBlocks
func (p *ProcessList) GetNewEBlocks(key interfaces.IHash) interfaces.IEntryBlock {
p.neweblockslock.Lock()
defer p.neweblockslock.Unlock()
return p.NewEBlocks[key.Fixed()]
}
示例8: AddNewEBlocks
func (p *ProcessList) AddNewEBlocks(key interfaces.IHash, value interfaces.IEntryBlock) {
p.neweblockslock.Lock()
defer p.neweblockslock.Unlock()
p.NewEBlocks[key.Fixed()] = value
}
示例9: GetOldMsgs
func (p *ProcessList) GetOldMsgs(key interfaces.IHash) interfaces.IMsg {
p.oldmsgslock.Lock()
defer p.oldmsgslock.Unlock()
return p.OldMsgs[key.Fixed()]
}
示例10: DeleteOldMsgs
func (p *ProcessList) DeleteOldMsgs(key interfaces.IHash) {
p.oldmsgslock.Lock()
defer p.oldmsgslock.Unlock()
delete(p.OldMsgs, key.Fixed())
}