Skip to content

Conversation

@gilesknap
Copy link
Member

@gilesknap gilesknap commented Jun 25, 2025

Add features to quickly add aliases or arbitrary chunks of Db directly from ioc.yaml.

e.g.

  - type: epics.DbAlias
    name: bl01t:SUM
    alias: bl01t:SUM99

  - type: epics.DbLine
    line: "# An arbitrary line to add to the ioc.db file"

  - type: epics.DbText
    text: |
      #
      # This is some arbitrary text for the Db
      # created using the epics.DbText entity
      #

@gilesknap gilesknap requested a review from coretl June 25, 2025 07:58
@gilesknap
Copy link
Member Author

@coretl I added this on Andrea's request - let me know if you have any ideas for improvement.

@coretl
Copy link

coretl commented Jun 25, 2025

@coretl I added this on Andrea's request - let me know if you have any ideas for improvement.

I believe we discussed this when thinking about putting in an equivalent to the builder records.ai in ibek. I can't find the reference for it now, but I think we decided that the issue was lack of schema, which required dbd parsing, so we thought there was not much point in adding:

  - type: records.ai
    name: A:RECORD
    DESC: A record
    VAL: 32

When you could write an ioc.db (using vscode epics plugin for syntax highlighting) containing:

record(ai, "A:RECORD") {
    field(DESC, "A record")
    field(VAL, "32")
}

Now we're adding native support for ioc.db I think that argument holds here too, unless I've missed a use case...

@amichelotti
Copy link
Contributor

amichelotti commented Jun 26, 2025

I've just tried epics.DbAlias. It works! and very useful! it's also nice that everything is done without modifications on ibek.

@gilesknap
Copy link
Member Author

@coretl I added this on Andrea's request - let me know if you have any ideas for improvement.

I believe we discussed this when thinking about putting in an equivalent to the builder records.ai in ibek. I can't find the reference for it now, but I think we decided that the issue was lack of schema, which required dbd parsing, so we thought there was not much point in adding:

  - type: records.ai
    name: A:RECORD
    DESC: A record
    VAL: 32

When you could write an ioc.db (using vscode epics plugin for syntax highlighting) containing:

record(ai, "A:RECORD") {
    field(DESC, "A record")
    field(VAL, "32")
}

Now we're adding native support for ioc.db I think that argument holds here too, unless I've missed a use case...

@coretl here is the discussion on epics.records epics-containers/ibek#302
We decided that @GDYendell was going to have a look at implementing it ! :-)

Andrea's use case was just to add one or two snippets or aliases quickly. I'm of the opinion that having this along side the more robust 'add a db file into config folder` is not an issue.

By the way, bringing this topic up again has made me question why we did decide to go ahead with epics-containers/ibek#302. The vscode DB editor is really nice and should be the primary method for adding arbitrary records.

@coretl
Copy link

coretl commented Jun 27, 2025

I think I'm happy with epics.DbAlias, I still have a mild preference for teaching ioc.db over epics.DbText and epics.DbLine, but happy to be overruled. Maybe @GDYendell can remember why we decided to try epics.records. If he can't remember either then maybe we close that issue and teach about ioc.db instead.

@GDYendell
Copy link
Member

GDYendell commented Jun 27, 2025

Reimplementing records. would be better than epics.DbText as the former could have schema, though it would be more work to parse it from dbd files. We definitely shouldn't have all 3 ways of adding database, though. I think DbText is the least nice option for DX because it could easily have errors that won't be found until the IOC boots. DbAlias seems fine as it is very well defined and less likely to cause boot time issues - is it a failure or just a warning if you add an alias for a PV that doesn't exist?

Maybe @GDYendell can remember why we decided to try epics.records

records. was the initial idea, then we decided just adding ioc.db would be simpler and more familiar.

@gilesknap
Copy link
Member Author

is it a failure or just a warning if you add an alias for a PV that doesn't exist?

I believe that is a warning. But it could easily imply that something is broken that you were expecting to work.

@gilesknap
Copy link
Member Author

So we are agreed that DbAlias is worth merging, can we not just have DbText as well for very quick tiny DB snippets.

We can recommend in our docs to use a separate db file and use the epics vscode extension to give some validation of that as you edit it.

@GDYendell
Copy link
Member

I think so. Does DbLine add anything vs DbText?

@gilesknap
Copy link
Member Author

No but DbLine is required to make DbText work as DbText is a repeat of DbLine :-)
Maybe we could put an underscore in front of _DbLine.

@GDYendell
Copy link
Member

Ah I see. OK sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants