MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / updateBilling

Method updateBilling

worker/dbms.go:205–234  ·  view source on GitHub ↗
(itx interfaces.Transaction, count uint32)

Source from the content-addressed store, hash-verified

203}
204
205func (dbms *DBMS) updateBilling(itx interfaces.Transaction, count uint32) {
206 var (
207 tx *types.UpdateBilling
208 ok bool
209 )
210 if tx, ok = itx.(*types.UpdateBilling); !ok {
211 log.WithFields(log.Fields{
212 "type": itx.GetTransactionType(),
213 }).WithError(ErrInvalidTransactionType).Warn("invalid tx type in update billing")
214 return
215 }
216 // Get profile and database instance
217 var (
218 id = tx.Receiver.DatabaseID()
219 profile *types.SQLChainProfile
220 database *Database
221 )
222 le := log.WithFields(log.Fields{
223 "id": id,
224 })
225 if database, ok = dbms.getMeta(id); !ok {
226 le.Warn("cannot find database")
227 return
228 }
229 if profile, ok = dbms.busService.RequestSQLProfile(id); !ok {
230 le.Warn("cannot find profile")
231 return
232 }
233 database.chain.SetLastBillingHeight(int32(profile.LastUpdatedHeight))
234}
235
236func (dbms *DBMS) createDatabase(tx interfaces.Transaction, count uint32) {
237 cd, ok := tx.(*types.CreateDatabase)

Callers

nothing calls this directly

Calls 8

getMetaMethod · 0.95
WithFieldsFunction · 0.92
WarnMethod · 0.80
WithErrorMethod · 0.80
DatabaseIDMethod · 0.80
RequestSQLProfileMethod · 0.80
SetLastBillingHeightMethod · 0.80
GetTransactionTypeMethod · 0.65

Tested by

no test coverage detected