| 900 | } |
| 901 | |
| 902 | func (sm *StackMachine) Run() { |
| 903 | r, e := db.Transact(func(tr fdb.Transaction) (interface{}, error) { |
| 904 | return tr.GetRange(tuple.Tuple{sm.prefix}, fdb.RangeOptions{}).GetSliceOrPanic(), nil |
| 905 | }) |
| 906 | if e != nil { |
| 907 | panic(e) |
| 908 | } |
| 909 | |
| 910 | instructions := r.([]fdb.KeyValue) |
| 911 | |
| 912 | for i, kv := range instructions { |
| 913 | inst, _ := tuple.Unpack(fdb.Key(kv.Value)) |
| 914 | |
| 915 | if sm.verbose { |
| 916 | fmt.Printf("Instruction %d\n", i) |
| 917 | } |
| 918 | sm.processInst(i, inst) |
| 919 | } |
| 920 | |
| 921 | sm.threads.Wait() |
| 922 | } |
| 923 | |
| 924 | var db fdb.Database |
| 925 | |